[Issue 999] New: Problem with auto and nested array literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 22 21:12:24 PST 2007


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

           Summary: Problem with auto and nested array literals
           Product: D
           Version: 1.007
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


There seems to be a problem with automatic type deduction of
nested array literals.


import std.stdio;

// This one compiles, (but causes runtime access violation if used)
auto gfoo = [[1.0],[2.0]];

void main() {
   writefln(typeid(typeof(gfoo))); // --> double[1][2], ok


   // this one doesn't compile
   auto foo = [[1.0],[2.0]];

/*
Error: cannot implicitly convert expression ([[1],[2]]) of type
double[][2] to double
*/

}


-- 



More information about the Digitalmars-d-bugs mailing list