Bug 1379 – Compiler doesn't allow associative array initializers.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-07-26T10:01:00Z
Last change time
2014-02-16T15:21:59Z
Keywords
rejects-valid
Assigned to
nobody
Creator
aziz.koeksal

Comments

Comment #0 by aziz.koeksal — 2007-07-26T10:01:17Z
auto foo = [1:1]; Getting the following errors for the above statement: Error: cannot infer type from this array initializer Error: array initializers as expressions are not allowed Error: cannot use array to initialize int Error: array initializers as expressions are not allowed variable foo is not a static and cannot have static initializer A nice workaround would be: auto foo = ([1:1]); // Works only in function bodies. Otherwise getting: Error: non-constant expression [1:1]
Comment #1 by rayerd.wiz — 2010-08-25T05:43:07Z
As dmd 2.048, this issue is already fixed.