July 15, 2008 [Issue 2228] New: Full closure does not honor loop context | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2228 Summary: Full closure does not honor loop context Product: D Version: 2.015 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: benoit@tionex.de With DMD 2.015: alias void delegate() Runner; void main(){ Runner[] runners; for( int i = 0; i < 3; i++ ){ const int ci = i; runners ~= delegate(){ writefln( "run with ci=%d", ci ); }; } foreach( runner; runners ){ runner(); } } Output: run with ci=2 run with ci=2 run with ci=2 It should be 0,1,2. -- |
July 27, 2008 [Issue 2228] Full closure does not honor loop context | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2228 brunodomedeiros+bugz@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from brunodomedeiros+bugz@gmail.com 2008-07-27 12:23 ------- My example is a bit less clear, but it's the same bug. *** This bug has been marked as a duplicate of 2043 *** -- |
Copyright © 1999-2021 by the D Language Foundation