www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2188] New: man-or-boy test fails with access violation

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

           Summary: man-or-boy test fails with access violation
           Product: D
           Version: 2.016
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: bugzilla digitalmars.com


because it doesn't handle lazy parameters right when generating a closure.
Works fine in D 1.0.

int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5)
{
    int delegate() b;
    b = { k -= 1; return a(k, b(), x1, x2, x3, x4); };
    if (k <= 0)
        return x4 + x5;
    else
        return b();
}

int main()
{
    assert(a(10, 1, -1, -1, 1, 0) == -67);
    return 0;
}


-- 
Jun 30 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2188


bugzilla digitalmars.com changed:

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




------- Comment #1 from bugzilla digitalmars.com  2008-07-09 22:43 -------
Fixed dmd 2.016


-- 
Jul 09 2008