Debian Codegraph @

libphobos/testsuite/libphobos.allocations/alloc_from_assert.d

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