Bug 19081 – Can't declare enum with UDA at statement level
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-07-12T15:15:39Z
Last change time
2018-07-17T10:59:21Z
Assigned to
No Owner
Creator
Yuxuan Shui
Comments
Comment #0 by yshuiv7 — 2018-07-12T15:15:39Z
Example:
@(1) enum A { A } // Fine
struct T1 {
@(1) struct T2 {} // Fine
@(1) enum A { A } // Fine
}
debug {
@(1) enum Op { Add, Sub } // Fine
}
unittest {
@(1) struct X { } // Fine
@(1) enum Op { Add, Sub } // Not fine ?!
}
void main() {}
https://godbolt.org/g/TSQeYW
Comment #1 by yshuiv7 — 2018-07-12T17:29:01Z
This is because, in
Comment #2 by yshuiv7 — 2018-07-12T17:31:41Z
This is because, at statement level, enum is also a storage class:
enum X = 10;
I wonder why declaring enum without a UDA works at statement level. I smell terrible hacks.
Comment #3 by github-bugzilla — 2018-07-17T10:59:20Z