www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9295] New: More implicit type conversion in array literals


           Summary: More implicit type conversion in array literals
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-01-11 10:50:50 PST ---
I think this code should compile:

void main() {
    auto vec = [1.0, 2]; // OK
    auto mat = [[1.0], [2]]; // error

Currently dmd v.2.062alpha gives:

test.d(3): Error: incompatible types for (([1]) ? ([2])): 'double[]' and

A person on IRC has suggested that in some cases this is not what you want.
Please add some of such examples below.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2013