Debian Codegraph @

libphobos/testsuite/libphobos.gc/attributes.d

raw
1 import core.memory;
2
3 // TODO: The following should work, but L10 (second assert) fails.
4 version(none) void dotest(T) (T* ptr)
5 {
6 GC.clrAttr(ptr, uint.max);
7 assert(GC.getAttr(ptr) == 0);
8
9 GC.setAttr(ptr, GC.BlkAttr.NO_MOVE);
10 assert(GC.getAttr(ptr) == GC.BlkAttr.NO_MOVE);
11
12 GC.clrAttr(ptr, GC.BlkAttr.NO_MOVE);
13 assert(GC.getAttr(ptr) == 0);
14 GC.clrAttr(ptr, GC.BlkAttr.NO_MOVE);
15 assert(GC.getAttr(ptr) == 0);
16 }
17 else void dotest(T) (T* ptr)
18 {
19 // https://issues.dlang.org/show_bug.cgi?id=21484
20 GC.clrAttr(ptr, uint.max);
21 GC.setAttr(ptr, GC.BlkAttr.NO_MOVE);
22 GC.getAttr(ptr);
23 }
24
25 void main ()
26 {
27 auto ptr = new int;
28 dotest!(const(int))(ptr);
29 dotest!(int)(ptr);
30 }