Lines Matching full:template

12template<typename T> CONST T wrong;           // expected-error {{member 'wrong' declared as a tem…
13template<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;
16template<typename T> CONST int right<int,T>; // expected-error {{member 'right' declared as a tem…
17template<typename T> CONST float right<float,T> = 5; // expected-error {{member 'right' declared …
18template<> static CONST int right<int,int> = 7; // expected-error {{explicit specialization …
19template<> static CONST float right<float,int>; // expected-error {{explicit specialization …
20template static CONST int right<int,int>; // expected-error {{template specialization requires…
26 template<typename T, typename T0> static CONST T right = T(100);
27 template<typename T> static CONST T right<T,int> = T(5);
29 template<> CONST int B0::right<int,int> = 7;
30 template CONST int B0::right<int,int>;
31 template<> CONST int B0::right<int,float>;
32 template CONST int B0::right<int,float>;
35 template<typename T, typename T0> static CONST T right;
36 template<typename T> static CONST T right<T,int>;
38 template<typename T, typename T0> CONST T B1::right = T(100);
39 template<typename T> CONST T B1::right<T,int> = T(5);
42template<typename T, typename T0> static CONST T right = T(100); // expected-note {{previous init…
43template<typename T> static CONST T right<T,int> = T(5); // expected-note {{previous init…
45template<typename T, typename T0> CONST T B2::right = T(100); // expected-error {{static data me…
46template<typename T> CONST T B2::right<T,int> = T(5); // expected-error {{static data me…
49 template<typename T, typename T0> static CONST T right = T(100);
50 template<typename T> static CONST T right<T,int> = T(5);
52 template<typename T, typename T0> CONST T B3::right;
53 template<typename T> CONST T B3::right<T,int>;
56 template<typename T, typename T0> static CONST T a;
57 template<typename T> static CONST T a<T,int> = T(100);
58 template<typename T, typename T0> static CONST T b = T(100);
59 template<typename T> static CONST T b<T,int>;
61template<typename T, typename T0> CONST T B4::a; // expected-error {{default initialization of an …
62 template<typename T> CONST T B4::a<T,int>;
63 template CONST int B4::a<int,char>; // expected-note {{in instantiation of}}
64 template CONST int B4::a<int,int>;
66 template<typename T, typename T0> CONST T B4::b;
67template<typename T> CONST T B4::b<T,int>; // expected-error {{default initialization of an object…
68 template CONST int B4::b<int,char>;
69 template CONST int B4::b<int,int>; // expected-note {{in instantiation of}}
74 template<typename T> static T wrong_inst_undefined = T(10); // expected-note {{refers here}}
75template<typename T> static T wrong_inst_defined = T(10); // expected-error {{non-const static dat…
76 template<typename T> static T wrong_inst_out_of_line;
79 template const int A::wrong_inst_undefined<const int>; // expected-error {{undefined}}
81 template<typename T> T A::wrong_inst_defined;
82 template const int A::wrong_inst_defined<const int>;
83template int A::wrong_inst_defined<int>; // expected-note {{in instantiation of static data member…
85 template<typename T> T A::wrong_inst_out_of_line = T(10);
86 template int A::wrong_inst_out_of_line<int>;
89 template<typename T> static T wrong_inst; // expected-note {{refers here}}
90template<typename T> static T wrong_inst<T*> = T(100); // expected-error {{non-const static data m…
92 template<typename T> static T wrong_inst_fixed;
93 template<typename T> static T wrong_inst_fixed<T*>;
95 template int B::wrong_inst<int>; // expected-error {{undefined}}
97 // template' diagnostic here, not the 'must be initialized out of line'
99template int B::wrong_inst<int*>; // expected-note {{in instantiation of static data member 'non_c…
100 template const int B::wrong_inst<const int*>; // expected-error {{undefined}}
101 template<typename T> T B::wrong_inst_fixed = T(100);
102 template int B::wrong_inst_fixed<int>;
105 template<typename T> static CONST T right_inst = T(10); // expected-note {{here}}
106 template<typename T> static CONST T right_inst<T*> = T(100); // expected-note {{here}}
108 template CONST int C::right_inst<int>; // expected-error {{undefined variable template}}
109 template CONST int C::right_inst<int*>; // expected-error {{undefined variable template}}
114 template<typename U> static U Data;
115 template<typename U> static CONST U Data<U*> = U(); // expected-note {{here}}
117 template<typename U> static U Data2;
118 template<typename U> static CONST U Data2<U*> = U();
122 template const int C0::Data<int*>; // expected-error {{undefined}}
124 template<typename U> const U C0::Data2<U*>;
125 template const int C0::Data2<int*>;
128 template<typename U> static U Data;
129 template<typename U> static U* Data<U*>; // Okay, with out-of-line definition
131 template<typename T> T* C1a::Data<T*> = new T();
132 template int* C1a::Data<int*>;
135 template<typename U> static U Data;
136 template<typename U> static CONST U* Data<U*>; // Okay, with out-of-line definition
138 template<typename T> CONST T* C1b::Data<T*> = (T*)(0);
139 template CONST int* C1b::Data<int*>;
142 template<typename U> static int Data;
143template<typename U> static U* Data<U*> = new U(); // expected-error {{non-const static data mem…
145template int* C2a::Data<int*>; // expected-note {{in instantiation of static data member 'non_cons…
148 template<typename U> static int Data;
149template<typename U> static U *const Data<U*> = (U*)(0); // expected-error {{static data member of…
151 template<typename U> U *const C2b::Data<U*>;
152template int *const C2b::Data<int*>; // expected-note {{in instantiation of static data member 'no…
159template<typename T> constexpr T wrong; // expected-error {{member 'wrong' declared as a…
161template<typename T> constexpr T wrong_init = 5; // expected-error {{non-static data member c…
162 template<typename T, typename T0> static constexpr T right = T(100);
163 template<typename T> static constexpr T right<T,int> = 5;
164template<typename T> constexpr int right<int,T>; // expected-error {{member 'right' declared as a…
166template<typename T> constexpr float right<float,T> = 5; // expected-error {{non-static data memb…
167template<> static constexpr int right<int,int> = 7; // expected-error {{explicit specializat…
168template<> static constexpr float right<float,int>; // expected-error {{explicit specializat…
169template static constexpr int right<int,int>; // expected-error {{template specialization requ…
177 template<typename T>
179 template<typename U> static U Data; // expected-note {{here}}
180 template<typename U> static CONST U Data<U*> = U();
182 template CONST int D0<float>::Data<int*>;
183 template int D0<float>::Data<int>; // expected-error {{undefined}}
184 template<typename T> template<typename U> const U D0<T>::Data<U*>;
186 template<typename T>
188 template<typename U> static U Data;
189 template<typename U> static U* Data<U*>;
191 template<typename T>
192 template<typename U> U* D1<T>::Data<U*> = (U*)(0);
193 template int* D1<float>::Data<int*>; // expected-note {{previous}}
194 template int* D1<float>::Data<int*>; // expected-error {{duplicate explicit instantiation}}
196 template<typename T>
198 template<typename U> static U Data;
199 template<typename U> static U* Data<U*>;
201 template<>
202 template<typename U> U* D2<float>::Data<U*> = (U*)(0) + 1;
203 template int* D2<float>::Data<int*>; // expected-note {{previous}}
204 template int* D2<float>::Data<int*>; // expected-error {{duplicate explicit instantiation}}
206 template<typename T>
208 template<typename U> static CONST U Data = U(100); // expected-note {{here}}
211 template const char D3<float>::Data<char>; // expected-error {{undefined}}
214 template<typename T>
216 template<typename U> static U Data;
217template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is …
219 template<>
220template<typename U> U D0a<float>::Data<U*> = U(100); // expected-error {{redefinition of 'Data'}}
225 // [temp.class.spec.mfunc]/2: If the primary member template is explicitly
226 // specialized for a given specialization of the enclosing class template,
227 // the partial specializations of the member template are ignored
228 template<typename T>
230 template<typename U> static U Data;
231template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is …
233 template<>
234 template<typename U> U D1<float>::Data = U(10);
235 template<>
236template<typename U> U D1<float>::Data<U*> = U(100); // expected-error{{redefinition of 'Data'}}
240 template<typename A> struct S {
241 template<typename B> static const int V1;
242 template<typename B> static const int V2;
244 template struct S<int>;
245 template<typename A> template<typename B> const int S<A>::V1 = 123;
246 template<typename A> template<typename B> const int S<A>::V2<B*> = 456;
251 // not picking up partial specializations added after the primary template
258 template<typename A> template<typename B> const int S<A>::V2<B&> = 789;
262 // instantiation of the class template specialization.
269 template<typename T> extern T var[];
270 template<typename T> T var[] = { 1, 2, 3 };
271 template<> char var<char>[] = "hello";
272 template<typename T> char var<T*>[] = "pointer";
278 template<typename...> struct tuple;
280 template<typename T> struct A {
281 template<typename U> static T x[];
282 template<typename U> static T y[];
284 template<typename...U> static T y<tuple<U...> >[];
288 template<typename T> template<typename U> T A<T>::x[sizeof(U)];
291 template<typename T> template<typename...U> T A<T>::y<tuple<U...> >[] = { U()... };
297 template<typename T> static int A; // expected-note 4{{here}}
300 template<typename T> void f() { in f()
301 …typename T::template A<int> a; // expected-error {{template name refers to non-type template 'S::A… in f()
303 template<typename T> void g() { in g()
304 … T::template A<int>::B = 0; // expected-error {{template name refers to non-type template 'S::A'}} in g()
306 template<typename T> void h() { in h()
307 … class T::template A<int> c; // expected-error {{template name refers to non-type template 'S::A'}} in h()
310 template<typename T>
311 …struct X : T::template A<int> {}; // expected-error {{template name refers to non-type template 'S…
313 template void f<S>(); // expected-note {{in instantiation of}}
314 template void g<S>(); // expected-note {{in instantiation of}}
315 template void h<S>(); // expected-note {{in instantiation of}}
316 template struct X<S>; // expected-note {{in instantiation of}}
326 template <int I>
333 template<typename T> struct helper {};
334 template<typename T> class A {
335template <typename> static helper<typename T::error> x; // expected-error {{type 'int' cannot be …
345 template<class T, T N> constexpr static T Var = N;
352 template<class T> struct A {
353 template<class U, T N, U M> static T&& Var;
355 template<class T> template<class U, T N, U M> T&& A<T>::Var = T(N + M);
365 template<class T>
369 template<typename TValue>
373 static_assert(TValue::template value<int> == 0, ""); // error in foo()