[Issue 8783] New: ref foreach update of const fixed size arrays in constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 8 10:38:55 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8783
Summary: ref foreach update of const fixed size arrays in
constructor
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 2012-10-08 10:20:50 PDT ---
This is a spinoff of Issue 6174
struct Foo {
int[1] bar;
}
const Foo[1] foos;
static this() {
foreach (i; 0 .. foos.length)
foos[i].bar[i] = 1; // OK
foreach (i, ref f; foos)
f.bar[i] = 1; // line 9, Error
}
void main() {}
DMD 2.061alpha gives:
temp.d(9): Error: cannot modify const expression f.bar[i]
--
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