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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Bruno Medeiros <[email protected]> 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: -------