1 import core.exception; 2 import core.memory; 3 4 class FailFinalization 5 { 6 int magic; 7 ~this()8 ~this () @nogc nothrow 9 { 10 try 11 assert(this.magic == 42); 12 catch (AssertError) {} 13 } 14 } 15 foo()16void foo () 17 { 18 auto dangling = new FailFinalization(); 19 } 20 main()21void main() 22 { 23 foo(); 24 GC.collect(); 25 } 26