www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5949] New: Mutable enum matrix rows

http://d.puremagic.com/issues/show_bug.cgi?id=5949

           Summary: Mutable enum matrix rows
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This D2 code compiles and runs with no errors (DMD 2.053beta), but it's wrong:


void main() {
    enum int[][] data = [[1]];
    foreach (a; data)
        a[0]++;
    assert(data[0][0] == 1);
    foreach (ref a; data)
        a[0]++;
    assert(data[0][0] == 1);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07 2011