www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9830] New: Wrong purity inference for a lambda?


           Summary: Wrong purity inference for a lambda?
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-03-29 11:44:42 PDT ---
I think foo2() too can be pure:

void main() {
    immutable int x;
    int foo1() pure { return x; } // OK
    int delegate() pure foo2 = () => x; // error

But DMD 2.063alpha gives:

test.d(4): Error: cannot implicitly convert expression (__lambda1) of type int
delegate() nothrow  safe to int delegate() pure

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