www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4359] New: Erroneous behaviour of variables in a delegate literal passed as template tuple parameter

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: bugzilla kyllingen.net



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: -------
Jun 21 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4359


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 4246 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 16 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4359




Actually bug 4246 is itself a duplicate of 1350.

*** This issue has been marked as a duplicate of issue 1350 ***

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