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.
@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
https://github.com/dlang/dlang.org/pull/3097
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