← Back to index
|
Original Bugzilla link
Bug 9647 – Ignored immutable in struct literal
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-03-04T17:23:00Z
Last change time
2013-03-05T07:25:02Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0
by bearophile_hugs — 2013-03-04T17:23:22Z
Issue found by Ali Çehreli:
http://forum.dlang.org/thread/
[email protected]
DMD 2.063alpha accepts this code, ignoring the immutable(): struct Foo { int[] arr; this(int[] arr_) { this.arr = arr_; } } void main() { auto arr = [1]; auto f = immutable(Foo)(arr); pragma(msg, typeof(f)); // Prints: Foo f.arr[0]++; }
Comment #1
by acehreli — 2013-03-04T17:45:39Z
Thanks bearophile... Note that the bug disappears when the constructor is removed.
Comment #2
by yebblies — 2013-03-05T07:25:02Z
*** This issue has been marked as a duplicate of issue 6578 ***