summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg/gdc183.d
blob: aa8a79c53e549461f00b8ca28bb88b9dd9b49028 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// https://bugzilla.gdcproject.org/show_bug.cgi?id=183
// { dg-do compile }

struct S183a
{
    union I183a
    {
        struct
        {
            double x, y, z;
        }
        struct
        {
            double a, b, c;
        }
    }

    I183a inner;

    this(double x, double y, double z)
    {
        this.inner.x = x;
        this.inner.y = y;
        this.inner.z = z;
    }
}

struct S183b
{
    @property get()
    {
        union Buf
        {
            void[0] result;
        }
        const Buf buf = { };
        return buf.result;
    }
}

struct S183c
{
    @property get()
    {
        union Buf
        {
            TypeInfo info;
            void[0] result;
        }
        const Buf buf = { };
        return buf.result;
    }
}

void test183()
{
    auto v1 = S183a(0, 0, 0);
    auto v2 = S183b().get;
    auto v3 = S183c().get;
}