Bug 10530 – Initializers inside named enum declarations cannot forward reference other members
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-03T09:48:00Z
Last change time
2013-11-20T22:50:26Z
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2013-07-03T09:48:00Z
DMD 2.063/git head:
enum X {foo=0, bar=foo} // ok
enum Y {foo=bar, bar=0} // error
Both lines should compile.
Comment #1 by timon.gehr — 2013-07-03T13:24:07Z
Actually it might be fine for the second line to be in error, since the compiler cannot easily figure out the enum base type in the general case when such a constellation is present.
This should certainly work though:
enum Y : int {foo=bar, bar=0}
Comment #2 by andrej.mitrovich — 2013-07-03T13:46:36Z
However this shouldn't work:
enum Y : int {foo=bar, bar}