aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/anon-union.cc
blob: fa75251778ad7dbe7a760dc078a78b56edd2401f (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

struct Foo {
  union {
    int zero;
    unsigned int one;
  } num1;
  struct X {
      int rock;
      unsigned int rock2;
  };
  union {
    int pebble;
    X 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;
};


int main()
{
  Foo foo = {0, 0};

  foo.paper = 33;
  foo.pebble = 44;
  foo.mux = 55;

  Bar bar = {0};

  union {
    int z;
    unsigned int w;
  }; w = 0;

  bar.x = 33;

  w = 45;

  int j = 0;
}