Bug 9642 – Missed switch case fallthrough

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-03T17:26:00Z
Last change time
2015-06-09T05:15:12Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-03-03T17:26:28Z
void main() { int x; switch ('x') { case 'a': x++; case 'b': .. case 'c': x++; break; default: } } With dmd 2.063alpha it compiles with no errors nor warnings. But I think it should give an error like: test.d(6): Error: switch case fallthrough - use 'goto default;' if intended
Comment #1 by andrej.mitrovich — 2013-03-03T17:34:42Z
It looks like it wasn't properly implemented, e.g. this will error with -w: void main() { int x; switch ('x') { case 'a': x++; case 'b':// .. case 'c': x++; break; default: } } Note the commented out code. Tested in 2.063 -- 2.060.
Comment #2 by r.sagitario — 2013-12-15T06:01:55Z
*** This issue has been marked as a duplicate of issue 11653 ***