summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++/anon-union.cc
blob: c58a30682239f4182337321189a5d4522c67dd5d (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

struct Foo {
  union {
    int zero;
    unsigned int one;
  } num1;

  union {
    int pebble;
    struct {
      int rock;
      unsigned int rock2;
    } x;
    union {
      int qux;
      unsigned int mux;
    };
    unsigned int boulder;
  };
  union {
    int paper;
    unsigned int cloth;
  };
  union {
    int two;
    unsigned int three;
  } num2;
};

union Bar {
  int x;
  unsigned int y;
};

Foo foo;
Bar bar;

int main()
{
  foo.paper = 33;
  foo.pebble = 44;
  foo.mux = 55;

  bar.x = 33;

  union
  {
    int z;
    unsigned int w;
  };

  w = 45;

}