Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test20603.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=20603
2
3 enum immutable(int)* x = new int(3);
4 enum const(int)* y = new int(5);
5
6 struct Base {
7 union {
8 int overlap;
9 immutable(Sub)* sub;
10 }
11
12 this(Sub) {
13 sub = new Sub;
14 }
15 }
16
17 struct Sub {
18 Base base;
19 }
20
21 immutable c0 = Base(Sub.init);
22
23 void main()
24 {
25 enum const(int)* z = new int(9);
26
27 assert(*x == 3);
28 assert(*y == 5);
29 assert(*z == 9);
30 assert(c0.sub.base.sub == null);
31 }