digitalmars.D.bugs - [Issue 12749] New: Constructor-local function allows multiple
- via Digitalmars-d-bugs (35/35) May 15 2014 https://issues.dlang.org/show_bug.cgi?id=12749
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 puremagic.com Reporter: acehreli 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 --
May 15 2014