www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14070] New: Letting compiler determine length for

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 puremagic.com
          Reporter: bearophile_hugs 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) {}
}

--
Jan 28 2015