[Issue 11051] Unmatched case in a final switch should throw in both release and non-release mode
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 16 07:42:33 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11051
--- Comment #3 from bearophile_hugs at eml.cc 2013-09-16 07:42:32 PDT ---
(In reply to comment #2)
> You mean *in release mode*, right?
Right, sorry.
> It currently throws in non-release mode, it doesn't throw in release mode.
This seems good to me. If you want to convert an untrusted value to an enum
safely you should use std.conv.to:
import std.stdio, std.conv;
enum E { a }
string get() {
//immutable e = cast(E)123;
immutable e = to!E(123);
final switch(e) {
case E.a: return "foobar";
}
}
void main() {
get.writeln;
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list