[Issue 5311] New: Pure is broken when accessing globals / static data through instance reference
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 3 06:27:50 PST 2010
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 at puremagic.com
ReportedBy: bdom.pub+deebugz at gmail.com
--- Comment #0 from Bruno Medeiros <bdom.pub+deebugz at 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: -------
More information about the Digitalmars-d-bugs
mailing list