https://issues.dlang.org/show_bug.cgi?id=20868
--- Comment #6 from RazvanN <[email protected]> --- (In reply to Walter Bright from comment #5) > To be specific, when compiled with -dip1000: > > void scoped (scope void delegate() dg) { > static void delegate()[] dgs; > dgs ~= dg; // Error: scope variable `dg` may not be copied into > allocated memory > } > > and there is no error without -dip1000. > > The first thing to do is simplify: > > void scoped (scope void* p) { > static void*[] px; > px ~= p; > } > > which exhibits the same behavior. But let's try this: > > void scoped (scope void* p) { > static void* px; > px = p; > } > > which generates no error with or without -dip1000. Marking the function with > @safe yields: > > Error: scope variable p is assigned to non-scope px > > with or without -dip1000. > > The examples must behave the same way. They don't, so which is right? The > array examples are wrong. So you agree with the PR I made? It essentially makes the error at line `dgs ~= dg;` go away in -dip1000 context. --
