summaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.gc/attributes.d
blob: a7acd6ce5500074d1e36985681d394a8a7ed7e9f (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
26
27
28
29
30
import core.memory;

// TODO: The following should work, but L10 (second assert) fails.
version(none) void dotest(T) (T* ptr)
{
    GC.clrAttr(ptr, uint.max);
    assert(GC.getAttr(ptr) == 0);

    GC.setAttr(ptr, GC.BlkAttr.NO_MOVE);
    assert(GC.getAttr(ptr) == GC.BlkAttr.NO_MOVE);

    GC.clrAttr(ptr, GC.BlkAttr.NO_MOVE);
    assert(GC.getAttr(ptr) == 0);
    GC.clrAttr(ptr, GC.BlkAttr.NO_MOVE);
    assert(GC.getAttr(ptr) == 0);
}
else void dotest(T) (T* ptr)
{
    // https://issues.dlang.org/show_bug.cgi?id=21484
    GC.clrAttr(ptr, uint.max);
    GC.setAttr(ptr, GC.BlkAttr.NO_MOVE);
    GC.getAttr(ptr);
}

void main ()
{
    auto ptr = new int;
    dotest!(const(int))(ptr);
    dotest!(int)(ptr);
}