// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17 %std_cxx98-14 %s // RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 -std=c++17 %s template class X> struct A; // #A // expected-note@-1 2{{previous template template parameter is here}} template class X> struct B; // expected-note{{previous template template parameter is here}} template class X> struct C; // expected-error@-1 {{conversion from 'int' to 'const int &' in converted constant expression would bind reference to a temporary}} // expected-note@-2 {{previous template template parameter is here}} template struct X; // expected-note {{template is declared here}} template struct Y; // expected-note {{template parameter is declared here}} template struct Ylong; template struct Yref; // expected-note {{template parameter is declared here}} namespace N { template struct Z; } template struct TooMany; // expected-note{{template is declared here}} A *a1; A *a2; A< ::N::Z> *a3; A *a4; // expected-error@#A {{template argument for non-type template parameter must be an expression}} // expected-note@-1 {{different template parameters}} A *a5; // expected-error {{too few template arguments for class template 'TooMany'}} // expected-note@-1 {{different template parameters}} B *a6; // expected-error {{too many template arguments for class template 'X'}} // expected-note@-1 {{different template parameters}} C *a7; C *a8; C *a9; // expected-note {{different template parameters}} template void f(int); A *a9; // expected-error{{must be a class template}} // Evil digraph '<:' is parsed as '[', expect error. A<::N::Z> *a10; #if __cplusplus <= 199711L // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} #endif // Do not do a digraph correction here. A<: :N::Z> *a11; // expected-error{{expected expression}} \ precxx17-error{{a type specifier is required for all declarations}} \ cxx17-error{{expected unqualified-id}} // PR7807 namespace N { template struct X { }; template struct Y { X const_ref(); }; template class TT, typename T, int N> int operator<<(int, TT a) { // expected-note{{candidate template ignored}} 0 << a.const_ref(); // expected-error{{invalid operands to binary expression ('int' and 'X')}} } void f0( Y y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<' requested here}} } // PR12179 template class F> #if __cplusplus <= 199711L // expected-warning@-2 {{variadic templates are a C++11 extension}} #endif struct unbox_args { typedef typename Primitive::template call x; }; template