https://issues.dlang.org/show_bug.cgi?id=18827
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from Dennis <[email protected]> --- It should allocate a closure, since `func` is free to escape the delegate, e.g.: ``` int delegate(int) global; int func(int delegate(int) dg) { global = dg; return dg(2); } void bar() { int a = 3; scope dg = (int x) => x * a; func(dg); // passing scope dg to non-scope parameter makes bar @system func((int x) scope => x * a); } ``` When marking the input delegate of `func` `scope`, it works: ``` @safe: int func(scope int delegate(int) @safe @nogc dg) @nogc { return dg(2); } void bar() @nogc { int a = 3; scope dg = (int x) => x * a; func(dg); func((int x) scope => x * a); } ``` --
