I set up to find out what happens if the assert string throws. I have to
admit I did not expect the result:
$ cat test.d
import std.stdio;
import core.exception;
void main() {
scope(failure) {
writeln("Not gonna happen");
}
try {
static string throwingFunc() {
throw new Exception("An exception");
}
assert(0==1, throwingFunc());
} catch(Exception ex) {
writeln("Exception");
} catch(AssertError ex) {
writeln("Assert");
}
}
$ ldc2 --version
LDC - the LLVM D compiler (1.8.0):
based on DMD v2.078.3 and LLVM 5.0.1
...
$ ./test
Not gonna happen
object.Exception@test.d(11): An exception
----------------
??:? [0x3728941e]
??:? [0x372903aa]
??:? [0x3727b15c]
??:? [0x3724991d]
??:? [0x372496c9]
??:? [0x3727aecf]
??:? [0x3727addb]
??:? [0x3724a124]
??:? __libc_start_main [0xed8b01c0]
??:? [0x372495c9]
$ dmd --version
DMD64 D Compiler v2.080.0
Copyright (C) 1999-2018 by The D Language Foundation, All Rights
Reserved written by Walter Bright
$ ./test
Not gonna happen
object.Exception@test.d(11): An exception
----------------
??:? pure @safe immutable(char)[] test.main().throwingFunc() [0xe9b1c2b3]
??:? _Dmain [0xe9b1c1ad]