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
Comment #1 by k.hara.pg — 2014-05-17T09:30:00Z
Comment #2 by github-bugzilla — 2014-05-31T07:03:38Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/32d08a20145608274a5423ee7e837225a2a91205 fix Issue 12749 - Constructor-local function allows multiple mutation of immutable member https://github.com/D-Programming-Language/dmd/commit/d1beeaa4a4608fa2d22c6a09bbe4357d2f6ed2cc Merge pull request #3555 from 9rnsr/fix12749 Issue 12749 - Constructor-local function allows multiple mutation of immutable member