Bug 5651 – Named enum doesn't work with associative arrays
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-02-24T14:20:00Z
Last change time
2012-02-04T20:47:17Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-02-24T14:20:01Z
// Ok
enum : int[string]
{
Circle = ["CoolCircle":50]
}
// Error: non-constant expression ["CoolCircle":50]
enum shapes : int[string]
{
Circle = ["CoolCircle":50]
}
Tested on XP32 && Ubuntu32.
Comment #1 by yebblies — 2012-02-04T20:47:17Z
Not a bug, the first declaration is essentially a horrible way to write:
enum int[string] Circle = ["CoolCircle":50];
While the second is an enum declaration, and enums do not support AAs as a base type.