[Issue 12753] All enum members trait, and missing function return values
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri May 16 02:53:40 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12753
--- Comment #2 from bearophile_hugs at eml.cc ---
(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.
--
More information about the Digitalmars-d-bugs
mailing list