[Issue 15612] New: Break immutability with default initialisers
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jan 26 00:25:20 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15612
Issue ID: 15612
Summary: Break immutability with default initialisers
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
void main()
{
immutable S s0;
S s1;
assert(s0.c.a == 42);
s1.c.a = -42;
assert(s0.c.a == 42); //FAILS!
}
struct S
{
C c = new C(42);
}
class C
{
int a;
this(int a)
{
this.a = a;
}
}
--
More information about the Digitalmars-d-bugs
mailing list