Summary: Lambda inside static foreach saves wrong value of
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Andrei Alexandrescu <> 2011-02-26 
09:25:07 PST ---
This program should print 1 but instead prints 0. Apparently all lambdas inside
a static foreach loop capture 0.

import std.stdio, std.typetuple;

void main() 
    TypeTuple!(int, float) TT;
    void function() funs[2];
    foreach (i, T; TT)
        funs[i] = function { writeln(i); };

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to