3 void lazyfun(scope lazy int a) @nogc;
5 // Test that returning a local _static_ struct does not lead to allocation of a closure.
6 auto foo_static(int a, bool b) @nogc {
7 static struct SInside {}
16 // Test that returning a local _non-static_ struct that does not reference any local variable does not lead to allocation of a closure.
17 auto foo_nonstatic(int a, bool b) @nogc {
27 // Test that returning a local non-static struct that references a local variable does lead to allocation of a closure.
28 static assert(!__traits(compiles, () @nogc => goo(1)));
29 static assert(__traits(compiles, () => goo(1)));