[Issue 1253] New: DMD 0.175 introduced bug: array initializers as expressions are not allowed?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 1 06:23:29 PDT 2007


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

           Summary: DMD 0.175 introduced bug: array initializers as
                    expressions are not allowed?
           Product: D
           Version: 0.175
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: oskar.linde at gmail.com


void main() {   
    struct T { int a; int b;}   
    const T[] arr = [{1,1},{2,2}];
    T[] arr2 = arr.dup;
    assert(arr2 == arr);
}

Gives:

test.d:3: Error: array initializers as expressions are not allowed
test.d:3: Error: array initializers as expressions are not allowed

Interestingly, commenting out the assert line makes the code compile.
changing const -> static also makes the code compile.

The bug is confirmed to exist on 0.175, 0.176, 0.178, 1.006, 1.007, 1.013 (gdc
0.23) and 1.014

On DMD 0.174 (and earlier), the code compiles ok.


-- 



More information about the Digitalmars-d-bugs mailing list