[Issue 14026] New: More flexible array of array allocation syntax

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 22 01:50:46 PST 2015


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 at puremagic.com
          Reporter: bearophile_hugs at 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;
}

--


More information about the Digitalmars-d-bugs mailing list