www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5311] New: Pure is broken when accessing globals / static data through instance reference

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5311

           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
        AssignedTo: nobody puremagic.com
        ReportedBy: bdom.pub+deebugz gmail.com


--- Comment #0 from Bruno Medeiros <bdom.pub+deebugz gmail.com> 2010-12-03
06:26:17 PST ---
See code below, there are two mutating accesses that should be error and are
not:

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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 03 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5311


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Platform|Other                       |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-11-10 22:24:54 PST ---
https://github.com/D-Programming-Language/dmd/pull/507

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 10 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5311


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2011-11-14
14:51:04 PST ---
https://github.com/D-Programming-Language/dmd/commit/760c2a66b58403810f2f6b07b7bfdca34c12e261

https://github.com/D-Programming-Language/dmd/commit/5efdc4a9ab80cd06d84e9d6b93d9c21cb3c55752

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