Summary: Pure is broken when accessing globals / static data
                    through instance reference
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD

--- Comment #0 from Bruno Medeiros <> 2010-12-03 
06:26:17 PST ---
See code below, there are two mutating accesses that should be error and are

class X {

    private static int globalData;

    void breaksPure() pure const
        //globalData++; // SHOULD BE ERROR
        //X.globalData++; // SHOULD BE ERROR
        this.globalData++; // SHOULD BE ERROR

        int a = this.globalData; // But readonly access is ok!


static void breaksPure2(X x) pure {
    x.globalData++; // SHOULD BE ERROR

    int a = x.globalData; // But readonly access is ok!

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to