www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10288] New: Direct lambda call and purity inference bug

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

           Summary: Direct lambda call and purity inference bug
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



In this code, foo and bar are essentially equivalent, but foo is not inferred
to pure.

T foo(T)(T x)
{
    ()  trusted { x += 10; } ();
    return x;
}
T bar(T)(T x)
{
    void lambda()  trusted nothrow { x += 10; }
    lambda();
    return x;
}
 safe pure nothrow void main()
{
    assert(foo(10) == 20);
    // -> Error: pure function 'main' cannot call impure function 'foo'

    assert(bar(10) == 20);
    // -> OK
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 06 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10288


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2143

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 06 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10288




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/66996ba9fa29cb3e83b66fd262158e7633380891
fix Issue 10288 - Direct lambda call and purity inference bug

https://github.com/D-Programming-Language/dmd/commit/e5ac1cb6c6c1b7ce07c60a991e7f0626552a9a95


Issue 10288 - Direct lambda call and purity inference bug

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 09 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10288


Kenji Hara <k.hara.pg gmail.com> changed:

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


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