xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/testsuite/libphobos.allocations/alloc_from_assert.d (revision b1e838363e3c6fc78a55519254d99869742dd33c)
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()16 void foo ()
17 {
18     auto dangling = new FailFinalization();
19 }
20 
main()21 void main()
22 {
23     foo();
24     GC.collect();
25 }
26