[SLP]Propagate AssumptionCache where possible
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.expl.spec / p2-20.cpp
blob935dd360847bc473612eb67caf003f5143dc70b4
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
3 template<typename T>
4 int x;
6 template<typename T>
7 static int x<T*>;
9 template<>
10 static int x<int>; // expected-warning {{explicit specialization cannot have a storage class}}
12 template<typename T>
13 extern int y;
15 template<typename T>
16 static int y<T*>;
18 template<>
19 static int y<int>; // expected-warning {{explicit specialization cannot have a storage class}}
21 template<typename T>
22 void f();
24 template<>
25 static void f<int>(); // expected-warning {{explicit specialization cannot have a storage class}}
27 template<typename T>
28 extern void g();
30 template<>
31 static void g<int>(); // expected-warning {{explicit specialization cannot have a storage class}}
33 struct A {
34 static int x;
36 static int y;
38 static void f();
40 static void g();
43 int A::x = 0;
45 static int A::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
47 void A::f() { }
49 static void A::g() { } // expected-error {{'static' can only be specified inside the class definition}}
51 struct B {
52 template<typename T>
53 static int x;
55 template<typename T>
56 static int y;
58 template<typename T>
59 int z; // expected-error {{non-static data member 'z' cannot be declared as a template}}
61 template<typename T>
62 static int x<T*>;
64 template<typename T>
65 static int y<T*>;
67 template<typename T>
68 int x<T**>; // expected-error {{non-static data member 'x' cannot be declared as a template}}
70 template<>
71 int x<short>;
73 template<>
74 static int x<long>; // expected-warning {{explicit specialization cannot have a storage class}}
76 template<typename T>
77 static void f();
79 template<typename T>
80 static void g();
82 template<>
83 void f<short>();
85 template<>
86 static void f<long>(); // expected-warning {{explicit specialization cannot have a storage class}}
89 template<typename T>
90 int B::x = 0;
92 template<typename T>
93 static int B::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
95 template<typename T>
96 int B::x<T*> = 0;
98 template<typename T>
99 static int B::y<T*> = 0; // expected-error {{'static' can only be specified inside the class definition}}
101 template<typename T>
102 int B::x<T***>;
104 template<typename T>
105 static int B::y<T***>; // expected-error {{'static' can only be specified inside the class definition}}
107 template<>
108 int B::x<unsigned>;
110 template<>
111 static int B::y<unsigned>; // expected-warning {{explicit specialization cannot have a storage class}}
112 // expected-error@-1 {{'static' can only be specified inside the class definition}}
114 template<typename T>
115 void B::f() { }
117 template<typename T>
118 static void B::g() { } // expected-error {{'static' can only be specified inside the class definition}}
120 template<>
121 void B::f<unsigned>();
123 template<>
124 static void B::g<unsigned>(); // expected-warning {{explicit specialization cannot have a storage class}}
125 // expected-error@-1 {{'static' can only be specified inside the class definition}}
127 template<typename T>
128 struct C {
129 static int x;
131 static int y;
133 static void f();
135 static void g();
138 template<typename T>
139 int C<T>::x = 0;
141 template<typename T>
142 static int C<T>::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
144 template<typename T>
145 void C<T>::f() { }
147 template<typename T>
148 static void C<T>::g() { } // expected-warning {{'static' can only be specified inside the class definition}}
150 template<>
151 int C<int>::x = 0;
153 template<>
154 static int C<int>::y = 0; // expected-warning {{explicit specialization cannot have a storage class}}
155 // expected-error@-1 {{'static' can only be specified inside the class definition}}
157 template<>
158 void C<int>::f();
160 template<>
161 static void C<int>::g(); // expected-warning {{explicit specialization cannot have a storage class}}
162 // expected-error@-1 {{'static' can only be specified inside the class definition}}
163 template<typename T>
164 struct D {
165 template<typename U>
166 static int x;
168 template<typename U>
169 static int y;
171 template<typename U>
172 int z; // expected-error {{non-static data member 'z' cannot be declared as a template}}
174 template<typename U>
175 static int x<U*>;
177 template<typename U>
178 static int y<U*>;
180 template<typename U>
181 int x<U**>; // expected-error {{non-static data member 'x' cannot be declared as a template}}
183 template<>
184 int x<short>;
186 template<>
187 static int x<long>; // expected-warning {{explicit specialization cannot have a storage class}}
189 template<typename U>
190 static void f();
192 template<typename U>
193 static void g();
195 template<>
196 void f<short>();
198 template<>
199 static void f<long>(); // expected-warning {{explicit specialization cannot have a storage class}}
202 template<typename T>
203 template<typename U>
204 int D<T>::x = 0;
206 template<typename T>
207 template<typename U>
208 static int D<T>::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
210 template<typename T>
211 template<typename U>
212 int D<T>::x<U*> = 0;
214 template<typename T>
215 template<typename U>
216 static int D<T>::y<U*> = 0; // expected-error {{'static' can only be specified inside the class definition}}
218 template<typename T>
219 template<typename U>
220 int D<T>::x<U***>;
222 template<typename T>
223 template<typename U>
224 static int D<T>::y<U***>; // expected-error {{'static' can only be specified inside the class definition}}
226 template<>
227 template<typename U>
228 int D<int>::x;
230 template<>
231 template<typename U>
232 static int D<int>::y; // expected-warning {{explicit specialization cannot have a storage class}}
233 // expected-error@-1 {{'static' can only be specified inside the class definition}}
234 template<>
235 template<typename U>
236 int D<int>::x<U****>;
238 template<>
239 template<typename U>
240 static int D<int>::y<U****>; // expected-warning {{explicit specialization cannot have a storage class}}
241 // expected-error@-1 {{'static' can only be specified inside the class definition}}
242 template<>
243 template<>
244 int D<int>::x<unsigned>;
246 template<>
247 template<>
248 static int D<int>::y<unsigned>; // expected-warning {{explicit specialization cannot have a storage class}}
249 // expected-error@-1 {{'static' can only be specified inside the class definition}}
251 template<typename T>
252 template<typename U>
253 void D<T>::f() { }
255 template<typename T>
256 template<typename U>
257 static void D<T>::g() { } // expected-warning {{'static' can only be specified inside the class definition}}
259 template<>
260 template<typename U>
261 void D<int>::f();
263 template<>
264 template<typename U>
265 static void D<int>::g(); // expected-warning {{explicit specialization cannot have a storage class}}
266 // expected-error@-1 {{'static' can only be specified inside the class definition}}
267 template<>
268 template<>
269 void D<int>::f<unsigned>();
271 template<>
272 template<>
273 static void D<int>::g<unsigned>(); // expected-warning {{explicit specialization cannot have a storage class}}
274 // expected-error@-1 {{'static' can only be specified inside the class definition}}