diff --git a/src/core/exception.d b/src/core/exception.d index c16894554c..7de406a9a2 100644 --- a/src/core/exception.d +++ b/src/core/exception.d @@ -574,14 +574,20 @@ extern (C) void onInvalidMemoryOperationError(void* pretend_sideffect = null) @t */ extern (C) void onSwitchError( string file = __FILE__, size_t line = __LINE__ ) @safe pure nothrow { - throw new SwitchError( file, line, null ); + version (D_Exceptions) + throw new SwitchError( file, line, null ); + else + assert(0, "No appropriate switch clause found"); } // Compiler lowers final switch default case to this (which is a runtime error) void __switch_errorT()(string file = __FILE__, size_t line = __LINE__) @trusted { // Consider making this a compile time check. - throw staticError!SwitchError(file, line, null); + version (D_Exceptions) + throw staticError!SwitchError(file, line, null); + else + assert(0, "No appropriate switch clause found"); } /**