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
*/
}