Bug 7320 – final switch on enum with backing type not statically checked

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-19T09:13:00Z
Last change time
2012-01-24T02:52:26Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
alex

Comments

Comment #0 by alex — 2012-01-19T09:13:51Z
This builds: enum Test : ubyte { foo, bar, baz, } void main() { auto i = Test.bar; final switch (i) { case Test.foo: break; } } Remove the : ubyte and it doesn't.
Comment #1 by alex — 2012-01-19T09:17:28Z
Andrej Mitrovic notes that if : int is specified as the backing type, the sample fails to build as expected. So, it seems as if any non-default backing type causes the bug.
Comment #2 by bearophile_hugs — 2012-01-19T10:30:48Z
See also issue 5713
Comment #3 by verylonglogin.reg — 2012-01-24T02:52:26Z
*** This issue has been marked as a duplicate of issue 4517 ***