Bug 15485 – switch with no case compiles

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-12-31T07:54:00Z
Last change time
2016-12-07T07:39:39Z
Assigned to
nobody
Creator
alex

Comments

Comment #0 by alex — 2015-12-31T07:54:40Z
The below code compiles, but fails at run time with "No appropriate switch clause found". This could be made a compiler error. void main() { int x = 10; switch (x) { if (x == 10) { return; } } }
Comment #1 by alex — 2015-12-31T07:56:04Z
I am using gdc, but I understand this would be a frontend issue.
Comment #2 by mk — 2016-12-07T00:56:57Z
This has been an error in dmd since 2.068. GDC bugs should be reported to https://bugzilla.gdcproject.org/
Comment #3 by ibuclaw — 2016-12-07T07:39:39Z
Don't even need to bother raising a bug in gdc (by the way this is fixed, not invalid).