1// RUN: %clang_cc1 -fsyntax-only %s -Wall
2
3template <typename T> class A { struct { }; };
4
5A<int> a0;
6
7template <typename T> struct B {
8  union {
9    int a;
10    void* b;
11  };
12
13  void f() {
14    a = 10;
15    b = 0;
16  }
17};
18
19B<int> b0;
20
21template <typename T> struct C {
22  union {
23    int a;
24    void* b;
25  };
26
27  C(int a) : a(a) { }
28  C(void* b) : b(b) { }
29};
30
31C<int> c0(0);
32
33namespace PR7088 {
34  template<typename T>
35  void f() {
36    union {
37      int a;
38      union {
39        float real;
40        T d;
41      };
42    };
43
44    a = 17;
45    d = 3.14;
46  }
47
48  template void f<double>();
49}
50
51// Check for problems related to PR7402 that occur when template instantiation
52// instantiates implicit initializers.
53namespace PR7402 {
54  struct X {
55    union {
56      struct {
57        int x;
58        int y;
59      };
60      int v[2];
61    };
62
63    // Check that this requirement survives instantiation.
64    template <typename T> X(const T& t) : x(t), y(t) {}
65  };
66
67  X x(42.0);
68}
69
70namespace PR9188 {
71  struct X0 {
72    union {
73      int member;
74    };
75  };
76
77  static union {
78    int global;
79  };
80
81  struct X1 : X0 {
82    template<typename T>
83    int f() {
84      return this->X0::member + PR9188::global;
85    }
86  };
87
88  template int X1::f<int>();
89}
90