April 05, 2013 [Issue 9884] New: Refused initialization of const array in the module static this() | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9884 Summary: Refused initialization of const array in the module static this() Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-04-05 11:15:22 PDT --- const int[] data; static this() { data = new int[10]; foreach (ref x; data) x = 1; // OK data[] = 1; // Error } void main() {} DMD 2.063alpha gives: test.d(5): Error: slice data[] is not mutable I think both ways to initialize "data" should be allowed, or both disallowed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation