[Issue 9647] New: Ignored immutable in struct literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 4 17:23:23 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9647
Summary: Ignored immutable in struct literal
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-03-04 17:23:22 PST ---
Issue found by Ali Çehreli:
http://forum.dlang.org/thread/kh3dkf$22eb$1@digitalmars.com
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]++;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list