@@ -19,29 +19,6 @@ void __switch_errorT()(string file = __FILE__, size_t line = __LINE__) @trusted
1919 assert (0 , " No appropriate switch clause found" );
2020}
2121
22- version (D_BetterC )
23- {
24- // When compiling with -betterC we use template functions so if they are
25- // used the bodies are copied into the user's program so there is no need
26- // for the D runtime during linking.
27-
28- // In the future we might want to convert all functions in this module to
29- // templates even for ordinary builds instead of providing them as an
30- // extern(C) library.
31-
32- void onOutOfMemoryError ()(void * pretend_sideffect = null ) @nogc nothrow pure @trusted
33- {
34- assert (0 , " Memory allocation failed" );
35- }
36- alias onOutOfMemoryErrorNoGC = onOutOfMemoryError;
37-
38- void onInvalidMemoryOperationError ()(void * pretend_sideffect = null ) @nogc nothrow pure @trusted
39- {
40- assert (0 , " Invalid memory operation" );
41- }
42- }
43- else :
44-
4522/**
4623 * Thrown on a range error.
4724 */
@@ -218,17 +195,17 @@ private void rangeMsgPut(ref char[] r, scope const(char)[] e) @nogc nothrow pure
218195 */
219196class AssertError : Error
220197{
221- @safe pure nothrow this ( string file, size_t line )
198+ @safe pure nothrow @nogc this ( string file, size_t line )
222199 {
223200 this (cast (Throwable)null , file, line);
224201 }
225202
226- @safe pure nothrow this ( Throwable next, string file = __FILE__ , size_t line = __LINE__ )
203+ @safe pure nothrow @nogc this ( Throwable next, string file = __FILE__ , size_t line = __LINE__ )
227204 {
228205 this ( " Assertion failure" , file, line, next);
229206 }
230207
231- @safe pure nothrow this ( string msg, string file = __FILE__ , size_t line = __LINE__ , Throwable next = null )
208+ @safe pure nothrow @nogc this ( string msg, string file = __FILE__ , size_t line = __LINE__ , Throwable next = null )
232209 {
233210 super ( msg, file, line, next );
234211 }
@@ -692,26 +669,49 @@ extern (C) void onFinalizeError( TypeInfo info, Throwable e, string file = __FIL
692669 throw staticError! FinalizeError(info, e, file, line);
693670}
694671
695- /**
696- * A callback for out of memory errors in D. An $(LREF OutOfMemoryError) will be
697- * thrown.
698- *
699- * Throws:
700- * $(LREF OutOfMemoryError).
701- */
702- extern (C ) void onOutOfMemoryError(void * pretend_sideffect = null ) @trusted pure nothrow @nogc /* dmd @@@BUG11461@@@ */
672+ version (D_BetterC )
703673{
704- // NOTE: Since an out of memory condition exists, no allocation must occur
705- // while generating this object.
706- throw staticError! OutOfMemoryError();
707- }
674+ // When compiling with -betterC we use template functions so if they are
675+ // used the bodies are copied into the user's program so there is no need
676+ // for the D runtime during linking.
708677
709- extern (C ) void onOutOfMemoryErrorNoGC() @trusted nothrow @nogc
710- {
711- // suppress stacktrace until they are @nogc
712- throw staticError! OutOfMemoryError(false );
678+ // In the future we might want to convert all functions in this module to
679+ // templates even for ordinary builds instead of providing them as an
680+ // extern(C) library.
681+
682+ void onOutOfMemoryError ()(void * pretend_sideffect = null ) @nogc nothrow pure @trusted
683+ {
684+ assert (0 , " Memory allocation failed" );
685+ }
686+ alias onOutOfMemoryErrorNoGC = onOutOfMemoryError;
687+
688+ void onInvalidMemoryOperationError ()(void * pretend_sideffect = null ) @nogc nothrow pure @trusted
689+ {
690+ assert (0 , " Invalid memory operation" );
691+ }
713692}
693+ else
694+ {
695+ /**
696+ * A callback for out of memory errors in D. An $(LREF OutOfMemoryError) will be
697+ * thrown.
698+ *
699+ * Throws:
700+ * $(LREF OutOfMemoryError).
701+ */
702+ extern (C ) void onOutOfMemoryError(void * pretend_sideffect = null ) @trusted pure nothrow @nogc /* dmd @@@BUG11461@@@ */
703+ {
704+ // NOTE: Since an out of memory condition exists, no allocation must occur
705+ // while generating this object.
706+ throw staticError! OutOfMemoryError();
707+ }
714708
709+ extern (C ) void onOutOfMemoryErrorNoGC() @trusted nothrow @nogc
710+ {
711+ // suppress stacktrace until they are @nogc
712+ throw staticError! OutOfMemoryError(false );
713+ }
714+ }
715715
716716/**
717717 * A callback for invalid memory operations in D. An
0 commit comments