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

--- Comment #3 from Kenji Hara <[email protected]> ---
(In reply to bearophile_hugs from comment #2)
> 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.

Because it will throw SwitchError in runtime.

void main() { bar4(cast(Foo)99); }

core.exception.SwitchError@test(3): No appropriate switch clause found

--

Reply via email to