[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaTemplate / instantiate-anonymous-union.cpp
blob68b233a7fda7d47d04313a27a2ab8543b84d635b
1 // RUN: %clang_cc1 -fsyntax-only %s -Wall
3 template <typename T> class A { struct { }; };
5 A<int> a0;
7 template <typename T> struct B {
8 union {
9 int a;
10 void* b;
13 void f() {
14 a = 10;
15 b = 0;
19 B<int> b0;
21 template <typename T> struct C {
22 union {
23 int a;
24 void* b;
27 C(int a) : a(a) { }
28 C(void* b) : b(b) { }
31 C<int> c0(0);
33 namespace PR7088 {
34 template<typename T>
35 void f() {
36 union {
37 int a;
38 union {
39 float real;
40 T d;
42 };
44 a = 17;
45 d = 3.14;
48 template void f<double>();
51 // Check for problems related to PR7402 that occur when template instantiation
52 // instantiates implicit initializers.
53 namespace PR7402 {
54 struct X {
55 union {
56 struct {
57 int x;
58 int y;
60 int v[2];
63 // Check that this requirement survives instantiation.
64 template <typename T> X(const T& t) : x(t), y(t) {}
67 X x(42.0);
70 namespace PR9188 {
71 struct X0 {
72 union {
73 int member;
77 static union {
78 int global;
81 struct X1 : X0 {
82 template<typename T>
83 int f() {
84 return this->X0::member + PR9188::global;
88 template int X1::f<int>();