Is there a way to do a checked cast from a base type to an enum-type (so that an exception is thrown if it fails)? ie something like enum x : dchar { A : 'a', B : 'b', C : 'c' }; x get_x() { dchar r = get_char(); return cast(x)r; //Throw exception if this cast fails }