// expected: closure captures outer variable(s) [recv] // // A bound method value holds its receiver, which is a capture: the closure // would have to carry the operand. Legacy rejects it for that reason, so // `defer c.Close()` is the only way to defer a method call - there the // receiver travels as an argument on the defer record, not in an environment. package main type Counter struct { n int32 } func (c *Counter) Close() { c.n = c.n + 1 } func main() { c := &Counter{} f := c.Close f() }