www.digitalmars.com         C & C++   DMDScript  

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

http://d.puremagic.com/issues/show_bug.cgi?id=9295

           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



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
'int[]'


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