https://issues.dlang.org/show_bug.cgi?id=20956
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Dennis <[email protected]> --- Reduced a bit more: ``` @safe: alias DG = void delegate() @safe; void main() { DG dg = getDg(42); stompStack(); dg(); } DG getDg(int val) { return forwardDg(val); } DG forwardDg(ref int c) { return () {assert(c == 42);}; } void stompStack() { int[256] oops = int.max; } ``` Also, it fails both with or without -dip1000. I think closing over a ref parameter should be an error (at least in `@safe` code), because it's really hard for `forwardDg` to create a closure including the stack frame of `getDg`: it has to be done at runtime, since you can't statically know where the `ref` parameter came from. --
