Bug 21389 – case statement in bad switch wrongly reported as duplicated

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-11-13T15:22:06Z
Last change time
2021-11-16T16:50:03Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Basile-z
See also
https://issues.dlang.org/show_bug.cgi?id=21404

Comments

Comment #0 by b2.temp — 2020-11-13T15:22:06Z
For the following bad code --- enum E : ubyte { e0, e1, e3, e4 } void main() { switch (node.e) { case E.e0: return; case E.e1: return; default: return; } } --- DMD reports: > /tmp/temp_7FAD2C00A670.d:10:13: Error: undefined identifier `node` > /tmp/temp_7FAD2C00A670.d:13:9: Error: duplicate `case e1` in `switch` statement The first error message is correct. The second error message is a bad diagnostic.
Comment #1 by b2.temp — 2020-11-13T15:24:10Z
According to the compilers available on run.dlan this wouldbe a 2.094 regression. (https://run.dlang.io/is/Svfzoy)
Comment #2 by moonlightsentinel — 2021-11-16T16:50:03Z
Marking as a duplicate of 22514 because that issue is referenced by the PR *** This issue has been marked as a duplicate of issue 22514 ***