digitalmars.D.bugs - [Issue 13085] New: Compiler does not reject storing global reference
- via Digitalmars-d-bugs (35/35) Jul 09 2014 https://issues.dlang.org/show_bug.cgi?id=13085
https://issues.dlang.org/show_bug.cgi?id=13085 Issue ID: 13085 Summary: Compiler does not reject storing global reference to scope delegate Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: hsteoh quickfur.ath.cx Code: ------ int delegate() globDg; void func(scope int delegate() dg) { globDg = dg; globDg(); } void sub() { int x; func(() { return ++x; }); } void trashme() { import std.stdio; writeln(globDg()); // prints garbage } void main() { sub(); trashme(); } ------ --
Jul 09 2014