www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1740] New: Full closure problem

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1740

           Summary: Full closure problem
           Product: D
           Version: 2.008
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


import std.stdio;
void func(string delegate() dg)
{
        dg();
}
void main()
{
        string[] k=["adf","AsdfadSF","dfdsfassdf"];
        foreach(d;k)
        {
                writefln(d);
                func(delegate string()
                {assert(d!="");return d;});             
        }
}
runtime result:
Error: AssertError Failure abc(13)
This make delegate in this case useless.


-- 
Dec 17 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1740


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 2.009


-- 
Jan 02 2008