Lines Matching full:template
12 …template<typename T> CONST T wrong; // expected-error {{member 'wrong' declared as a tem…
13 …template<typename T> CONST T wrong_init = 5; // expected-error {{member 'wrong_init' declared…
14 template<typename T, typename T0> static CONST T right = T(100);
15 template<typename T> static CONST T right<T,int> = 5;
16 …template<typename T> CONST int right<int,T>; // expected-error {{member 'right' declared as a tem…
17 …template<typename T> CONST float right<float,T> = 5; // expected-error {{member 'right' declared …
18 template<> static CONST int right<int,int> = 7;
19 template<> static CONST float right<float,int>;
20 template static CONST int right<int,int>; // expected-error {{expected '<' after 'template'}}
25 template<typename T, typename T0> static CONST T right = T(100);
26 template<typename T> static CONST T right<T,int> = T(5);
28 template<> CONST int B0::right<int,int> = 7; // expected-note {{previous}}
29 template CONST int B0::right<int,int>; // expected-warning {{has no effect}}
30 template<> CONST int B0::right<int,float>; // expected-note {{previous}}
31 template CONST int B0::right<int,float>; // expected-warning {{has no effect}}
34 template<typename T, typename T0> static CONST T right;
35 template<typename T> static CONST T right<T,int>;
37 template<typename T, typename T0> CONST T B1::right = T(100);
38 template<typename T> CONST T B1::right<T,int> = T(5);
41 …template<typename T, typename T0> static CONST T right = T(100); // expected-note {{previous init…
42 …template<typename T> static CONST T right<T,int> = T(5); // expected-note {{previous init…
44 …template<typename T, typename T0> CONST T B2::right = T(100); // expected-error {{static data me…
45 …template<typename T> CONST T B2::right<T,int> = T(5); // expected-error {{static data me…
48 template<typename T, typename T0> static CONST T right = T(100);
49 template<typename T> static CONST T right<T,int> = T(5);
51 template<typename T, typename T0> CONST T B3::right;
52 template<typename T> CONST T B3::right<T,int>;
55 template<typename T, typename T0> static CONST T a;
56 template<typename T> static CONST T a<T,int> = T(100);
57 template<typename T, typename T0> static CONST T b = T(100);
58 template<typename T> static CONST T b<T,int>;
60 …template<typename T, typename T0> CONST T B4::a; // expected-error {{default initialization of an …
61 template<typename T> CONST T B4::a<T,int>;
62 template CONST int B4::a<int,char>; // expected-note {{in instantiation of}}
63 template CONST int B4::a<int,int>;
65 template<typename T, typename T0> CONST T B4::b;
66 …template<typename T> CONST T B4::b<T,int>; // expected-error {{default initialization of an object…
67 template CONST int B4::b<int,char>;
68 template CONST int B4::b<int,int>; // expected-note {{in instantiation of}}
73 template<typename T> static T wrong_inst_undefined = T(10); // expected-note {{refers here}}
74 …template<typename T> static T wrong_inst_defined = T(10); // expected-error {{non-const static dat…
75 template<typename T> static T wrong_inst_out_of_line;
78 template const int A::wrong_inst_undefined<const int>; // expected-error {{undefined}}
80 template<typename T> T A::wrong_inst_defined;
81 template const int A::wrong_inst_defined<const int>;
82 …template int A::wrong_inst_defined<int>; // expected-note {{in instantiation of static data member…
84 template<typename T> T A::wrong_inst_out_of_line = T(10);
85 template int A::wrong_inst_out_of_line<int>;
88 template<typename T> static T wrong_inst; // expected-note {{refers here}}
89 …template<typename T> static T wrong_inst<T*> = T(100); // expected-error {{non-const static data m…
91 template<typename T> static T wrong_inst_fixed;
92 template<typename T> static T wrong_inst_fixed<T*>;
94 template int B::wrong_inst<int>; // expected-error {{undefined}}
96 // template' diagnostic here, not the 'must be initialized out of line'
98 …template int B::wrong_inst<int*>; // expected-note {{in instantiation of static data member 'non_c…
99 template const int B::wrong_inst<const int*>; // expected-error {{undefined}}
100 template<typename T> T B::wrong_inst_fixed = T(100);
101 template int B::wrong_inst_fixed<int>;
104 template<typename T> static CONST T right_inst = T(10); // expected-note {{here}}
105 template<typename T> static CONST T right_inst<T*> = T(100); // expected-note {{here}}
107 template CONST int C::right_inst<int>; // expected-error {{undefined variable template}}
108 template CONST int C::right_inst<int*>; // expected-error {{undefined variable template}}
113 template<typename U> static U Data;
114 template<typename U> static CONST U Data<U*> = U(); // expected-note {{here}}
116 template<typename U> static U Data2;
117 template<typename U> static CONST U Data2<U*> = U();
121 template const int C0::Data<int*>; // expected-error {{undefined}}
123 template<typename U> const U C0::Data2<U*>;
124 template const int C0::Data2<int*>;
127 template<typename U> static U Data;
128 template<typename U> static U* Data<U*>; // Okay, with out-of-line definition
130 template<typename T> T* C1a::Data<T*> = new T();
131 template int* C1a::Data<int*>;
134 template<typename U> static U Data;
135 template<typename U> static CONST U* Data<U*>; // Okay, with out-of-line definition
137 template<typename T> CONST T* C1b::Data<T*> = (T*)(0);
138 template CONST int* C1b::Data<int*>;
141 template<typename U> static int Data;
142 …template<typename U> static U* Data<U*> = new U(); // expected-error {{non-const static data mem…
144 …template int* C2a::Data<int*>; // expected-note {{in instantiation of static data member 'non_cons…
147 template<typename U> static int Data;
148 …template<typename U> static U *const Data<U*> = (U*)(0); // expected-error {{static data member of…
150 template<typename U> U *const C2b::Data<U*>;
151 …template int *const C2b::Data<int*>; // expected-note {{in instantiation of static data member 'no…
158 …template<typename T> constexpr T wrong; // expected-error {{member 'wrong' declared as a…
160 …template<typename T> constexpr T wrong_init = 5; // expected-error {{non-static data member c…
161 template<typename T, typename T0> static constexpr T right = T(100);
162 template<typename T> static constexpr T right<T,int> = 5;
163 …template<typename T> constexpr int right<int,T>; // expected-error {{member 'right' declared as a…
165 …template<typename T> constexpr float right<float,T> = 5; // expected-error {{non-static data memb…
166 template<> static constexpr int right<int,int> = 7;
167 …template <> static constexpr float right<float, int>; // expected-error {{declaration of constexpr…
168 …template static constexpr int right<int,int>; // expected-error {{expected '<' after 'template…
175 template<typename T>
177 template<typename U> static U Data; // expected-note {{here}}
178 template<typename U> static CONST U Data<U*> = U();
180 template CONST int D0<float>::Data<int*>;
181 template int D0<float>::Data<int>; // expected-error {{undefined}}
182 template<typename T> template<typename U> const U D0<T>::Data<U*>;
184 template<typename T>
186 template<typename U> static U Data;
187 template<typename U> static U* Data<U*>;
189 template<typename T>
190 template<typename U> U* D1<T>::Data<U*> = (U*)(0);
191 template int* D1<float>::Data<int*>; // expected-note {{previous}}
192 template int* D1<float>::Data<int*>; // expected-error {{duplicate explicit instantiation}}
194 template<typename T>
196 template<typename U> static U Data;
197 template<typename U> static U* Data<U*>;
199 template<>
200 template<typename U> U* D2<float>::Data<U*> = (U*)(0) + 1;
201 template int* D2<float>::Data<int*>; // expected-note {{previous}}
202 template int* D2<float>::Data<int*>; // expected-error {{duplicate explicit instantiation}}
204 template<typename T>
206 template<typename U> static CONST U Data = U(100); // expected-note {{here}}
209 template const char D3<float>::Data<char>; // expected-error {{undefined}}
212 template<typename T>
214 template<typename U> static U Data;
215 …template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is …
217 template<>
218 …template<typename U> U D0a<float>::Data<U*> = U(100); // expected-error {{redefinition of 'Data'}}
223 // [temp.class.spec.mfunc]/2: If the primary member template is explicitly
224 // specialized for a given specialization of the enclosing class template,
225 // the partial specializations of the member template are ignored
226 template<typename T>
228 template<typename U> static U Data;
229 …template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is …
231 template<>
232 template<typename U> U D1<float>::Data = U(10);
233 template<>
234 … template<typename U> U D1<float>::Data<U*> = U(100); // expected-error{{redefinition of 'Data'}}
238 template<typename A> struct S {
239 template<typename B> static const int V1;
240 template<typename B> static const int V2; // expected-note 3{{here}}
242 template struct S<int>;
243 template<typename A> template<typename B> const int S<A>::V1 = 123;
244 template<typename A> template<typename B> const int S<A>::V2<B*> = 456;
249 // not picking up partial specializations added after the primary template
256 template<typename A> template<typename B> const int S<A>::V2<B&> = 789;
260 // instantiation of the class template specialization.
267 template<typename T> extern T var[];
268 template<typename T> T var[] = { 1, 2, 3 };
269 template<> char var<char>[] = "hello";
270 template<typename T> char var<T*>[] = "pointer";
276 template<typename...> struct tuple;
278 template<typename T> struct A {
279 template<typename U> static T x[];
280 template<typename U> static T y[];
282 template<typename...U> static T y<tuple<U...> >[];
286 template<typename T> template<typename U> T A<T>::x[sizeof(U)];
289 template<typename T> template<typename...U> T A<T>::y<tuple<U...> >[] = { U()... };
295 template<typename T> static int A; // expected-note 4{{here}}
298 template<typename T> void f() { in f()
299 …typename T::template A<int> a; // expected-error {{template name refers to non-type template 'S::t… in f()
301 template<typename T> void g() { in g()
302 …T::template A<int>::B = 0; // expected-error {{template name refers to non-type template 'S::templ… in g()
304 template<typename T> void h() { in h()
305 …class T::template A<int> c; // expected-error {{template name refers to non-type template 'S::temp… in h()
308 template<typename T>
309 …struct X : T::template A<int> {}; // expected-error {{template name refers to non-type template 'S…
311 template void f<S>(); // expected-note {{in instantiation of}}
312 template void g<S>(); // expected-note {{in instantiation of}}
313 template void h<S>(); // expected-note {{in instantiation of}}
314 template struct X<S>; // expected-note {{in instantiation of}}
324 template <int I>
331 template<typename T> struct helper {};
332 template<typename T> class A {
333 …template <typename> static helper<typename T::error> x; // expected-error {{type 'int' cannot be …
343 template<class T, T N> constexpr static T Var = N;
350 template<class T> struct A {
351 template<class U, T N, U M> static T&& Var;
353 template<class T> template<class U, T N, U M> T&& A<T>::Var = T(N + M);
363 template<class T>
367 template<typename TValue>
371 static_assert(TValue::template value<int> == 0, ""); // error in foo()
385 template<int = 0> static int n; // expected-note 2{{here}}
387 …int &r = A::template n; // expected-error {{use of variable template 'n' requires template argumen…
389 template<typename T>
390 …int &f() { return T::template n; } // expected-error {{use of variable template 'n' requires templ… in f()
394 template<int = 0> static int n; // expected-note {{here}}
396 …int &t = B::template n; // expected-error {{use of variable template 'n' requires template argumen…
401 template <int> struct TakesInt {};
403 template <class T2>
405 template <class T1>
408 template <class T>