http://d.puremagic.com/issues/show_bug.cgi?id=4359

           Summary: Erroneous behaviour of variables in a delegate literal
                    passed as template tuple parameter
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bugzi...@kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzi...@kyllingen.net> 2010-06-21 
11:40:00 PDT ---
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
        }
    })();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to