aboutsummaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.allocations/alloc_from_assert.d
blob: a377cd9139de0803936e838cef35ddc5b8ddc7a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import core.exception;
import core.memory;

class FailFinalization
{
    int magic;

    ~this () @nogc nothrow
    {
        try
            assert(this.magic == 42);
        catch (AssertError) {}
    }
}

void foo ()
{
    auto dangling = new FailFinalization();
}

void main()
{
    foo();
    GC.collect();
}