Bug 999 – Problem with auto and nested array literals

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-02-22T23:12:00Z
Last change time
2014-02-16T15:25:49Z
Keywords
rejects-valid, wrong-code
Assigned to
nobody
Creator
wbaxter

Comments

Comment #0 by wbaxter — 2007-02-22T23:12:17Z
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 */ }
Comment #1 by thomas-dloop — 2007-02-26T05:36:42Z
Comment #2 by smjg — 2007-09-27T16:36:11Z
*** Bug 919 has been marked as a duplicate of this bug. ***
Comment #3 by clugdbug — 2009-08-12T06:37:21Z
This, the Dstress cases, and the cases in 919, all work in DMD1.045 and 2.030. (Tested both Windows + Linux).