Bug 21431 – Incorrect maximum and actual number of cases in a switch case range is reported

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-11-26T19:00:19Z
Last change time
2021-09-09T07:15:41Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Max Samukha

Comments

Comment #0 by maxsamukha — 2020-11-26T19:00:19Z
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.
Comment #1 by dlang-bot — 2021-09-08T15:55:15Z
@dkorpel created dlang/dmd pull request #13058 "Fix issue 21431 - Incorrect maximum and actual number of cases in a switch case range is reported" fixing this issue: - fix issue 21431 - Incorrect maximum and actual number of cases in a switch case range is reported https://github.com/dlang/dmd/pull/13058
Comment #2 by bugzilla — 2021-09-08T19:45:28Z
Comment #3 by dlang-bot — 2021-09-09T07:15:41Z
dlang/dmd pull request #13058 "Fix issue 21431 - Incorrect maximum and actual number of cases in a switch case range is reported" was merged into master: - c075c4e00a992ffe495837600b89a92943ccbbb5 by dkorpel: fix issue 21431 - Incorrect maximum and actual number of cases in a switch case range is reported https://github.com/dlang/dmd/pull/13058