[Issue 12749] New: Constructor-local function allows multiple mutation of immutable member
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu May 15 14:00:20 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12749
Issue ID: 12749
Summary: Constructor-local function allows multiple mutation of
immutable member
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: acehreli at yahoo.com
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/tigvenrazuwgvxcaescy@forum.dlang.org
Ali
--
More information about the Digitalmars-d-bugs
mailing list