digitalmars.D.bugs - [Issue 21389] New: case statement in bad switch wrongly reported as
- d-bugmail puremagic.com (32/34) Nov 13 2020 https://issues.dlang.org/show_bug.cgi?id=21389
https://issues.dlang.org/show_bug.cgi?id=21389 Issue ID: 21389 Summary: case statement in bad switch wrongly reported as duplicated Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: b2.temp gmx.com 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` statementThe first error message is correct. The second error message is a bad diagnostic. --
Nov 13 2020