[Issue 9884] New: Refused initialization of const array in the module static this()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 5 11:15:23 PDT 2013
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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at 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: -------
More information about the Digitalmars-d-bugs
mailing list