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

--- Comment #2 from [email protected] ---
(In reply to Kenji Hara from comment #1)

> It's wrong assumption. By using cast, you can give undefined enum value to
> bar1 and bar2.
> 
> bar1(cast(Foo)99);
> bar2(cast(Foo)99);
> 
> Therefore, the compiler error is legitimate.


What about this similar code:


enum Foo { A, B, C }
int bar4(immutable Foo x) {
    final switch (x) with (Foo) {
        case A: return 0;
        case B: return 1;
        case C: return 2;
    }
}
void main() {}


Here there is no return at the end of the function.

--

Reply via email to