[Issue 11051] Unmatched case in a final switch should throw in both release and non-release mode

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 19 02:45:48 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=11051

--- Comment #8 from bearophile_hugs at eml.cc ---
(In reply to Don from comment #7)

> Only a 'genuine enumeration' makes sense in a final switch.

I'd like "final switch" to support (safely) code like this too:

void main(in string[] args) {
    // Today immutable keeps the value range.
    immutable n = args % 3; 

    final switch(n) {
        case 0: break;
        case 1: break;
        case 2: break;
    }
}

--


More information about the Digitalmars-d-bugs mailing list