[Issue 21431] New: Incorrect maximum and actual number of cases in a switch case range is reported
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 26 19:00:19 UTC 2020
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 at puremagic.com
Reporter: maxsamukha at 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.
--
More information about the Digitalmars-d-bugs
mailing list