1 // expected: closure captures outer variable(s)
2 //
3 // A Moxie closure is a standalone function: it receives what it needs through
4 // its parameters and has no environment carrying outer locals. Legacy rejects
5 // a capturing closure in restrict.go; stage4 accepted one, so a program that
6 // only stage4 compiled could tie a closure's lifetime to a dead frame arena.
7 package main
8 9 func main() {
10 x := int32(5)
11 f := func() (r int32) { return x }
12 println(f())
13 }
14