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

           Summary: Purity correctness is broken with constructor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: zan77...@nifty.com


--- Comment #0 from SHOO <zan77...@nifty.com> 2013-06-03 07:57:24 PDT ---
This code doesn't work:
---------------
int a;
auto foo() pure
{
    static class A { this(){a = 2;} }
    return new A; // This line should be a compilation error.
}
void main()
{
    a = 1;
    auto x = foo(); // Pure function doesn't change any global variables.
    assert(a == 1); // Thefore, global variable `a` never changes.
}

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

Reply via email to