Bug 7746 – Error with 'TOK232' declaring enum of anonymous nested class type
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-21T08:33:00Z
Last change time
2013-09-16T01:31:55Z
Keywords
diagnostic
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2012-03-21T08:33:51Z
enum x = new class { int n = 4; };
static assert(x.n == 4);
bug.d(5): Error: static assert (TOK232.n == 4) is not evaluatable at compile time
Comment #1 by clugdbug — 2012-03-21T08:45:30Z
It probably should generate an error on creation of the enum.
Comment #2 by k.hara.pg — 2013-09-16T01:31:55Z
In git head, error message is improved.
enum x = new class { int n = 4; };
static assert(x.n == 4);
test.d(1): Error: variable test.x : Unable to initialize enum with class or pointer to struct. Use static const variable instead.