summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail19917.d
blob: c6ad83b89a76b5c06e2a486bca8e5e4eb44c8987 (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
/*
TEST_OUTPUT:
---
fail_compilation/fail19917.d(22): Error: overlapping default initialization for field `c` and `a`
fail_compilation/fail19917.d(22): Error: overlapping default initialization for field `d` and `b`
fail_compilation/fail19917.d(39): Error: overlapping default initialization for field `b` and `a`
---
*/

struct S
{
    union
    {
        struct
        {
            int a = 3;
            int b = 4;
        }
   }
}

struct X
{
    union
    {
        struct
        {
            int a = 3;
            int b = 4;
        }
        struct
        {
            int c = 3;
            int d = 4;
        }
    }
}

struct Y
{
    union
    {
        struct
        {
            union { int a = 3; }
        }
        int b = 4;
    }
}