On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote:
- You use `scope myDG = (Params) { body... }`
It looks like i is still moved to the heap but marking `test` with @nogc compiles successfully. Then when I run the code the assertion is triggered. What exactly is going on here?
auto test() @nogc //Compiles
{
int i = 10;
scope dg = { assert(i == 10); }; //AssertFailure
i = 11;
return dg;
}
void main()
{
auto dg = test();
dg();
}
