Bug 12749 – Constructor-local function allows multiple mutation of immutable member
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-15T21:00:00Z
Last change time
2014-05-31T07:03:39Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
acehreli
Comments
Comment #0 by acehreli — 2014-05-15T21:00:20Z
struct S
{
immutable int i_;
this(int i)
{
void set(int i)
{
i_ = i;
}
set(i);
set(i); // effectively second mutation of immutable member
}
}
void main()
{
auto s = S(1);
}
Also see the following thread for another example with immutable array:
http://forum.dlang.org/thread/[email protected]
Ali