summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/runnable/test20603.d
blob: 47fd3985555c06ecadcec582dac49177e13467f0 (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
31
// https://issues.dlang.org/show_bug.cgi?id=20603

enum immutable(int)* x = new int(3);
enum const(int)* y = new int(5);

struct Base {
    union {
        int overlap;
        immutable(Sub)* sub;
    }

    this(Sub) {
        sub = new Sub;
    }
}

struct Sub {
    Base base;
}

immutable c0 = Base(Sub.init);

void main()
{
    enum const(int)* z = new int(9);

    assert(*x == 3);
    assert(*y == 5);
    assert(*z == 9);
    assert(c0.sub.base.sub == null);
}