summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/test18216.d
blob: 43f5629a3c7d9e26f2b5d719198aa5ff905f63d5 (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
32
33
34
35
36
37
38
39
40
// https://issues.dlang.org/show_bug.cgi?id=18216

struct Node
{
    mixin Type!();
    Pointer left;
}

mixin template Type()
{
    alias Base = typeof(this);

    static struct Proxy
    {
        struct Node
        {
            Base m_payload;
        }
        static immutable default_value = Base.init; // just remove this will work
    }

    alias pNode = shared(Proxy.Node)*;

    static struct Pointer
    {
        Base*   _ptr;
        auto ptr()
        {
            return cast(pNode) _ptr;
        }

        void opAssign(ref Pointer other) {} // just remove this will work

        alias getThis this; // just remove this will work
        ref auto getThis() return
        {
            return ptr.m_payload;
        }
    }
}