View mode: basic / threaded / horizontal-split · Log in · Help
January 11, 2013
[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


--- 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
'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: -------
Top | Discussion index | About this forum | D home