[Issue 14070] New: Letting compiler determine length for fixed-length arrays in foreach

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jan 28 06:45:27 PST 2015


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

          Issue ID: 14070
           Summary: Letting compiler determine length for fixed-length
                    arrays in foreach
           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

Related to Issue 481

Given the recent improvements for type inference for arrays
(https://github.com/D-Programming-Language/dmd/pull/3615 ), I think it can be
handy to also support:

void main() {
    int[2][] m = [[1, 2], [3, 4], [5, 6]];
    foreach (auto[2] a; m) {}
    foreach (int[$] a; m) {}
}

--


More information about the Digitalmars-d-bugs mailing list