digitalmars.D.bugs - [Issue 21431] New: Incorrect maximum and actual number of cases in a
- d-bugmail puremagic.com (28/28) Nov 26 2020 https://issues.dlang.org/show_bug.cgi?id=21431
https://issues.dlang.org/show_bug.cgi?id=21431 Issue ID: 21431 Summary: Incorrect maximum and actual number of cases in a switch case range is reported Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: diagnostic Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: maxsamukha gmail.com 256 is reported to be the maximum number of cases allowed in a case range: void main() { switch (0) { case 0:..case 257: break; default: } } onlineapp.d(7): Error: had 257 cases which is more than 256 cases in case range The error message is wrong about both the maximum allowed number (which is actually 257) and the actual number of cases (258 in the example). Something is off by one. --
Nov 26 2020