1 // Regression: zero-binding closure not wrapped in SSAMakeClosure.
2 //
3 // The SSA builder's buildFuncLit returned a bare *SSAFunction for function
4 // literals with zero captured variables. When this function was stored in a
5 // variable and called, the emitter tried extractvalue {ptr,ptr} on the
6 // loaded value, which was a ptr not {ptr,ptr}.
7 //
8 // Reproduces: function literal with zero free variables, stored and called.
9 // Fixed in: pkg/ssa/ssa_builder.mx (SSAFunction now always wrapped).
10 11 package main
12 13 func main() {
14 fn := func() {
15 println("x")
16 }
17 fn()
18 }
19