Thread overview
[Issue 10288] New: Direct lambda call and purity inference bug
Jun 07, 2013
Kenji Hara
Jun 07, 2013
Kenji Hara
Jun 10, 2013
Kenji Hara
June 07, 2013
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


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-06 22:16:56 PDT ---
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: -------
June 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10288


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

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-06 22:26:34 PDT ---
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: -------
June 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10288



--- Comment #2 from github-bugzilla@puremagic.com 2013-06-09 12:51:23 PDT ---
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 Merge pull request #2143 from 9rnsr/fix10288

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: -------
June 10, 2013
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: -------