Summary: case ranges in final switches
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-03-07 04:31:23 PST ---
This is a low-priority enhancement suggestion.

If the type to final-switch on has a natural ordering (so it's not an enum!),
like a char/ubyte/byte, then in some situations I'd like to use the range

void main() {
     ubyte u;
     final switch (u) {
         case   0: .. case 100: break;
         case 101: .. case 255: break;

Currently DMD 2.052 gives the errors:
test.d(4): Error: case ranges not allowed in final switch
test.d(5): Error: case ranges not allowed in final switch

See also bug 5713

If case ranges are not allowed on full-range int values, then you can't use
them in a final switch.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to