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