Home | History | Annotate | Download | only in SemaCXX

Lines Matching full:template

11 template<typename T> 
12 T pi = T(3.1415926535897932385); // expected-note {{template is declared here}}
14 template<typename T>
15 CONST T cpi = T(3.1415926535897932385); // expected-note {{template is declared here}}
17 template<typename T> extern CONST T vc;
32 // template arguments are not deduced for uses of variable templates.
33 int ipi = pi; // expected-error {{cannot refer to variable template 'pi' without a template argument list}}
34 int icpi = cpi; // expected-error {{cannot refer to variable template 'cpi' without a template argument list}}
37 template<typename T>
42 template<typename T>
71 template<typename T> T v; // expected-error {{redefinition of 'v' as different kind of symbol}}
74 template<typename T> T v; // expected-note {{previous definition is here}}
78 template<typename T> T v0; // expected-note {{previous definition is here}}
79 template<typename T> T v0; // expected-error {{redefinition of 'v0'}}
81 template<typename T> T v; // expected-note {{previous definition is here}}
82 template<typename T> int v; // expected-error {{redefinition of 'v'}}
84 template<typename T> extern int v1; // expected-note {{previous template declaration is here}}
85 template<int I> int v1; // expected-error {{template parameter has a different kind in template redeclaration}}
88 template<typename T> T v;
93 template<typename T, typename> T v; // expected-note 2{{previous template declaration is here}}
94 template<typename T> T v; // expected-error {{too few template parameters in template redeclaration}}
95 template<typename T, typename, typename> T v; // expected-error {{too many template parameters in template redeclaration}}
99 template<typename T> T v = T();
100 template<typename T> extern T v; // redeclaration is allowed \
102 template<typename T> extern int v; // expected-error {{redeclaration of 'v' with a different type: 'int' vs 'T'}}
105 template<typename T> extern auto v; // expected-error {{declaration of variable 'v' with type 'auto' requires an initializer}}
108 template<typename T> T var = T(); // expected-note {{previous definition is here}}
114 template<typename T> auto v0; // expected-error {{declaration of variable 'v0' with type 'auto' requires an initializer}}
115 template<typename T> auto v1 = T(); // expected-note {{previous definition is here}}
116 template<typename T> int v1; // expected-error {{redefinition of 'v1' with a different type: 'int' vs 'auto'}}
117 template<typename T> auto v2 = T(); // expected-note {{previous definition is here}}
118 template<typename T> T v2; // expected-error {{redefinition of 'v2'}}
119 template<typename T> auto v3 = T(); // expected-note {{previous definition is here}}
120 template<typename T> extern T v3; // expected-error {{redeclaration of 'v3' with a different type: 'T' vs 'auto'}}
121 template<typename T> auto v4 = T();
122 template<typename T> extern auto v4; // expected-error {{declaration of variable 'v4' with type 'auto' requires an initializer}}
129 template<typename T>
130 T pi0a = T(3.1415926535897932385); // expected-note {{variable template 'pi0a' declared here}}
131 template float pi0a<int>; // expected-error {{type 'float' of explicit instantiation of 'pi0a' does not match expected type 'int'}}
133 template<typename T>
134 T pi0b = T(3.1415926535897932385); // expected-note {{variable template 'pi0b' declared here}}
135 template CONST int pi0b<int>; // expected-error {{type 'const int' of explicit instantiation of 'pi0b' does not match expected type 'int'}}
137 template<typename T>
138 T pi0c = T(3.1415926535897932385); // expected-note {{variable template 'pi0c' declared here}}
139 template int pi0c<const int>; // expected-error {{type 'int' of explicit instantiation of 'pi0c' does not match expected type 'const int'}}
141 template<typename T>
143 template int pi0<int>; // expected-note {{previous explicit instantiation is here}}
144 template int pi0<int>; // expected-error {{duplicate explicit instantiation of 'pi0<int>'}}
146 template<typename T>
147 CONST T pi1a = T(3.1415926535897932385); // expected-note {{variable template 'pi1a' declared here}}
148 template int pi1a<int>; // expected-error {{type 'int' of explicit instantiation of 'pi1a' does not match expected type 'const int'}}
150 template<typename T>
151 CONST T pi1b = T(3.1415926535897932385); // expected-note {{variable template 'pi1b' declared here}}
152 template int pi1b<const int>; // expected-error {{type 'int' of explicit instantiation of 'pi1b' does not match expected type 'const const int'}}
154 template<typename T>
156 template CONST int pi1<int>; // expected-note {{previous explicit instantiation is here}}
157 template CONST int pi1<int>; // expected-error {{duplicate explicit instantiation of 'pi1<int>'}}
161 template<typename T> auto var0 = T();
162 template auto var0<int>; // expected-error {{'auto' variable template instantiation is not allowed}}
164 template<typename T> auto var = T();
165 template int var<int>;
169 template<typename=int> int missing_args; // expected-note {{here}}
170 template int missing_args; // expected-error {{must specify a template argument list}}
180 template<typename T1, typename T2>
183 template<typename T>
186 template<typename T>
189 template<> CONST int pi2<int,int> = 4;
205 template<typename T1, typename T2>
208 template<typename T>
211 template<typename T>
221 template<typename T>
224 template<> float pi0<int> = 10;
225 template<> int pi0<const int> = 10;
227 template<typename T>
229 template<> CONST int pi1<int> = 10;
231 template<typename T>
233 template<> int pi2<const int> = 10;
235 template<typename T>
237 template<> int pi4<int> = 10;
241 template<typename T>
244 template<> int pi0<int> = 10; // expected-note 3{{previous definition is here}}
248 template<> int pi0<int> = 10; // expected-error {{redefinition of 'pi0<int>'}}
249 template<> CONST int pi0<int> = 10; // expected-error {{redefinition of 'pi0' with a different type: 'const int' vs 'int'}}
250 template<> float pi0<int> = 10; // expected-error {{redefinition of 'pi0' with a different type: 'float' vs 'int'}}
252 template<> auto pi0<int> = 10; // expected-error {{redefinition of 'pi0<int>'}}
256 template<typename T>
259 template<> CONST int pi1<int> = 10; // expected-note {{previous definition is here}}
260 template<> CONST int pi1<int> = 10; // expected-error {{redefinition of 'pi1<int>'}}
264 template<typename T>
265 T pi0 = T(3.1415926535897932385); // expected-note {{variable template 'pi0' declared here}}
267 template<> int pi0<int> = 10;
268 template int pi0<int>;
269 template float pi0<int>; // expected-error {{type 'float' of explicit instantiation of 'pi0' does not match expected type}}
271 template<typename T1, typename T2>
274 template<typename T> CONST int pi2<T,int> = 2;
275 template CONST int pi2<int,int>;
278 template<typename T>
281 template int pi0<int>; // expected-note 2{{explicit instantiation first required here}}
282 template<> int pi0<int> = 10; // expected-error {{explicit specialization of 'pi0' after instantiation}}
283 template<> float pi0<int>; // expected-error {{explicit specialization of 'pi0' after instantiation}}
285 template<typename T1, typename T2>
288 template CONST int pi2<int,int>;
289 template<typename T> CONST int pi2<T,int> = 2;
294 template<typename T, typename> auto var0 = T();
295 template<typename T> auto var0<T,int> = T();
296 template<> auto var0<int,int> = 7;
298 template<typename T, typename> auto var = T();
299 template<typename T> T var<T,int> = T(5);
300 template<> int var<int,int> = 7;
315 template<typename T> T* var = new T();
317 template<typename T> auto var<T*> = T(); // expected-note {{previous definition is here}}
318 template<typename T> T var<T*> = T(); // expected-error {{redefinition of 'var' with a different type: 'T' vs 'auto'}}
324 template<typename T> T v = {1234}; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 1234 to}}
329 int k = v<char>; // expected-note {{in instantiation of variable template specialization 'narrowing::v<char>' requested here}}
342 template<typename T>
346 template<> float* arr<float> = &f;
363 template<typename T>
370 template float pi0a<float>;
373 template<> double pi0a<double> = 5.2;
377 template<typename T>
383 template float n0b::pi0b<float>;
386 template<> double n0b::pi0b<double> = 5.2;
390 template<typename T>
396 template<typename T>
407 template float pi1a<float>;
413 template<> double pi1a<double> = 5.2; // expected-error {{variable template specialization of 'pi1a' must originally be declared in namespace 'n1'}}
420 template float n1::pi1b<float>;
426 template<> double n1::pi1b<double> = 5.2; // expected-error {{cannot define or redeclare 'pi1b' here because namespace 'use_n1b' does not enclose namespace 'n1'}} \
427 // expected-error {{variable template specialization of 'pi1b' must originally be declared in namespace 'n1'}}
433 template<typename T> int a; // expected-note {{variable template 'a' declared here}}
434 a<int>::b c; // expected-error {{qualified name refers into a specialization of variable template 'a'}}
436 class a<int> {}; // expected-error {{identifier followed by '<' indicates a class template specialization but 'a' refers to a variable template}}
441 template<typename T> int a;
442 int a<int>; // expected-error {{requires 'template<>'}}
447 template<typename T> const auto x = 1;
453 template <typename T> int* f();
454 template <typename T> void f();
455 template<> int f<double>; // expected-error {{no variable template matches specialization; did you mean to use 'f' as function template instead?}}
457 template <typename T> void g();
458 template<> int g<double>; // expected-error {{no variable template matches specialization; did you mean to use 'g' as function template instead?}}