www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14026] New: More flexible array of array allocation syntax

https://issues.dlang.org/show_bug.cgi?id=14026

          Issue ID: 14026
           Summary: More flexible array of array allocation syntax
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

Perhaps we can support this syntax:

void main() {
    uint n = 10; // Run-time value.
    int[][3] m = new int[][3](n);
}


That in dmd2.067alpha gives:

test5.d(3,30): Error: function expected before (), not new int[][](3u) of type
int[][]


That means:

void main() {
    uint n = 10; // Run-time value.
    int[][3] m;
    foreach (ref a; m)
        a.length = n;
}

--
Jan 22 2015