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: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@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: -------

Reply via email to