Lines Matching full:template
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING
8 export class foo { }; // expected-error {{expected template}}
9 template x; // expected-error {{C++ requires a type specifier for all declarations}} \
11 export template x; // expected-error {{expected '<' after 'template'}}
12 export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
13 template < ; // expected-error {{expected template parameter}} \
14 // expected-error{{expected ',' or '>' in template-parameter-list}} \
16 template <int +> struct x1; // expected-error {{expected ',' or '>' in template-parameter-list}}
18 // verifies that we only walk to the ',' & still produce errors on the rest of the template paramet…
19 template <int +, T> struct x2; // expected-error {{expected ',' or '>' in template-parameter-list}}…
21 template<template<int+>> struct x3; // expected-error {{expected ',' or '>' in template-parameter-l…
22 … expected-error {{template template parameter requires 'class' after the parameter list}}
23 template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
25 template <template <typename> > struct Err2; // expected-error {{template template parameter …
26 template <template <typename> Foo> struct Err3; // expected-error {{template template parameter …
28 template <template <typename> typename Foo> struct Cxx1z;
33 // Template function declarations
34 template <typename T> void foo();
35 template <typename T, typename U> void foo();
37 // Template function definitions.
38 template <typename T> void foo() { }
40 // Template class (forward) declarations
41 template <typename T> struct A;
42 template <typename T, typename U> struct b;
43 template <typename> struct C;
44 template <typename, typename> struct D;
47 template <typename T = int> class X1;
48 template <typename = int> class X2;
50 // Forward declarations w/template template parameters
51 template <template <typename> class T> class TTP1;
52 template <template <typename> class> class TTP2;
53 template <template <typename> class T = foo> class TTP3; // expected-error{{must be a class templat…
54 template <template <typename> class = foo> class TTP3; // expected-error{{must be a class template}}
55 template <template <typename X, typename Y> class T> class TTP5;
58 template <int> class NTP0;
59 template <int N> class NTP1;
60 template <int N = 5> class NTP2;
61 template <int = 10> class NTP3;
62 template <unsigned int N = 12u> class NTP4;
63 template <unsigned int = 12u> class NTP5;
64 template <unsigned = 15u> class NTP6;
65 template <typename T, T Obj> class NTP7;
67 // Template class declarations
68 template <typename T> struct A { };
69 template <typename T, typename U> struct B { };
71 // Template parameter shadowing
72 template<typename T, // expected-note{{template parameter is declared here}}
73 typename T> // expected-error{{declaration of 'T' shadows template parameter}}
76 template<typename T> // expected-note{{template parameter is declared here}}
77 void shadow2(int T); // expected-error{{declaration of 'T' shadows template parameter}}
79 template<typename T> // expected-note{{template parameter is declared here}}
80 class T { // expected-error{{declaration of 'T' shadows template parameter}}
83 template<int Size> // expected-note{{template parameter is declared here}}
84 void shadow3(int Size); // expected-error{{declaration of 'Size' shadows template parameter}}
87 template<typename T> // expected-note{{here}}
92 template<typename T> // expected-note{{here}}
97 template<typename T, // expected-note{{template parameter is declared here}}
98 T T> // expected-error{{declaration of 'T' shadows template parameter}}
101 template<typename T, // expected-note{{template parameter is declared here}}
102 … template<typename> class T> // expected-error{{declaration of 'T' shadows template parameter}}
106 template<template<typename> class T> struct shadow8 { // expected-note{{template parameter is decla…
107 …template<template<typename> class T> struct inner; // expected-error{{declaration of 'T' shadows t…
110 // Non-type template parameters in scope
111 template<int Size>
121 template<typename T>
131 template <> struct S<int> { }; // expected-error{{explicit specialization of undeclared template st…
132 template <> union U<int> { }; // expected-error{{explicit specialization of undeclared template uni…
136 template <> struct SS<int> { }; // expected-error{{explicit specialization of non-template struct '…
137 template <> union UU<int> { }; // expected-error{{explicit specialization of non-template union 'UU…
141 template <typename T>
145 template <typename T>
149 // This PR occurred only in template parsing mode.
151 template <int>
153 template <typename T>
155 template <typename U>
160 template <int k>
161 template <typename T>
162 template <typename U>
184 template<bool b> struct bool_ { typedef int type; };
185 template<> struct bool_<false> { };
192 template <int>
194 template <typename T>
196 template <typename U>
201 template <int k>
202 template <typename T>
203 template <typename U>
206 template<>
207 template<>
208 template<typename U>
220 // We failed to diagnose function template specialization definitions inside
222 template <class> void FuncTemplate() {}
226 typename template <> void FuncTemplate<void>() { }
233 template<typename T>
249 template<typename T> void f(T);
250 template void f<int>(int); // expected-error {{expected '<' after 'template'}}
251 template void f(float); // expected-error {{expected '<' after 'template'}}
252 extern template // expected-error {{expected member name or ';'}}
258 …template<int SomeTemplateName<void>> struct A; // expected-error {{parameter name cannot have temp…
259 …template<int operator+> struct B; // expected-error {{'operator+' cannot be the name of a paramete…
261 template<int Q::N> struct C; // expected-error {{parameter declarator cannot be qualified}}
262 …template<int f(int a = 0)> struct D; // expected-error {{default arguments can only be specified f…
266 template<int I, int J> struct A { };
267 template<int J> struct A<0, J> { }; // expected-note {{J = 0}}
268 template<int I> struct A<I, 0> { }; // expected-note {{I = 0}}
274 template<class=class a::template b<>> struct X {}; // expected-error {{undeclared identifier 'a'}}
278 template <typename FnT,
279 … typename T = typename ABC<FnT>::template arg_t<0>> // expected-error {{no template named 'ABC'}}
286 template<int> int b;
287 template<int> auto f() -> b<0>; // expected-error +{{}}
291 template; // expected-error {{declaration does not declare anything}}
292 template<>; // expected-error {{declaration does not declare anything}}
293 template<int>; // expected-error {{declaration does not declare anything}}
294 template int; // expected-error {{declaration does not declare anything}}
295 template<> int; // expected-error {{declaration does not declare anything}}
296 template<int> int; // expected-error {{declaration does not declare anything}}