D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5651 - Named enum doesn't work with associative arrays
Summary: Named enum doesn't work with associative arrays
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-02-24 14:20 UTC by Andrej Mitrovic
Modified: 2012-02-04 20:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2011-02-24 14:20:01 UTC
// 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 yebblies 2012-02-04 20:47:17 UTC
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.