www.digitalmars.com         C & C++   DMDScript  

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

http://d.puremagic.com/issues/show_bug.cgi?id=9830

           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



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