www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12925] New: Implicit cast of associative arrays in array

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

          Issue ID: 12925
           Summary: Implicit cast of associative arrays in array literal
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

I don't know if this is a bug:


void main() {
    double[int][] aa1 = [[1: 2.0], [3: 4]]; // OK
    auto          aa2 = [[1: 2.0], [3: 4]]; // Error
}


DMD 2.066alpha gives:

test.d(3,36): Error: incompatible types for (([1:2.00000]) : ([3:4])):
'double[int]' and 'int[int]'

--
Jun 15 2014