Bug 4359 – Erroneous behaviour of variables in a delegate literal passed as template tuple parameter

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-06-21T11:40:00Z
Last change time
2010-07-16T10:20:02Z
Keywords
wrong-code
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2010-06-21T11:40:00Z
In the code below, the variable i is never increased above x+1. It seems the declaration inside the loop somehow overwrites i. (Note that the writeln() is only for demonstration purposes and has nothing to do with the bug.) import std.stdio; void run(fun...)() { fun[0](); } void main() { run!(delegate void() { for (int i = 0; i < 100_000; i++) { writeln(i); auto x = 0; // i never exceeds 1 } })(); }
Comment #1 by clugdbug — 2010-07-16T10:14:06Z
*** This issue has been marked as a duplicate of issue 4246 ***
Comment #2 by clugdbug — 2010-07-16T10:20:02Z
Actually bug 4246 is itself a duplicate of 1350. *** This issue has been marked as a duplicate of issue 1350 ***