Bug 9358 – Compiler creates duplicate switch cases after an error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-20T10:11:00Z
Last change time
2013-01-20T16:49:37Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-01-20T10:11:22Z
void main() { double x; switch (x) { case 1: break; case 2: break; default: } } test.d(6): Error: 'x' must be of integral or string type, it is a double test.d(8): Error: case must be a string or an integral constant, not 1 test.d(9): Error: case must be a string or an integral constant, not 2 test.d(9): Error: duplicate case 0 in switch statement The last error message shouldn't appear.
Comment #1 by andrej.mitrovich — 2013-01-20T10:16:34Z
Comment #2 by github-bugzilla — 2013-01-20T16:49:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f8b994352501e50dca6b9a064be3462d6ac343cd Fixes Issue 9358 - Compiler creates duplicate switch cases on error. https://github.com/D-Programming-Language/dmd/commit/3e3d8f8fdc478c80190be8a25d1e7a6ea1d9c79d Merge pull request #1521 from AndrejMitrovic/Fix9358 Issue 9358 - Compiler creates duplicate switch cases on error