// RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // RUN: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -fdelayed-template-parsing // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fdelayed-template-parsing template struct A {}; // Check for template argument lists followed by junk // FIXME: The diagnostics here aren't great... A int x; // expected-error {{expected '>'}} expected-note {{to match this '<'}} expected-error {{expected unqualified-id}} A'}} expected-note {{to match this '<'}} // PR8912 template struct S {}; S 1)> s; // Test behavior when a template-id is ended by a token which starts with '>'. namespace greatergreater { template struct S { S(); S(T); }; void f(S=0); // expected-error {{a space is required between a right angle bracket and an equals sign (use '> =')}} void f(S>=S()); // expected-error {{use '> >'}} expected-error {{use '> ='}} template void t(); void g() { void (*p)() = &t; (void)(&t==p); // expected-error {{use '> ='}} (void)(&t>=p); // expected-error {{use '> >'}} (void)(&t>>=p); #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif (void)(&t>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}} } } namespace PR5925 { template class foo { // expected-note {{here}} }; void bar(foo *X) { // expected-error {{requires template arguments}} } } namespace PR13210 { template class C {}; // expected-note {{here}} void f() { new C(); // expected-error {{requires template arguments}} } } // Don't emit spurious messages namespace pr16225add { template struct Known { }; // expected-note 3 {{template is declared here}} template struct X; template struct ABC; // expected-note {{template is declared here}} template struct ABC2 {}; template struct foo : UnknownBase // expected-error {{no template named 'UnknownBase'}} { }; template struct foo2 : UnknownBase, // expected-error {{no template named 'UnknownBase'}} Known // expected-error {{too few template arguments for class template 'Known'}} { }; template struct foo3 : UnknownBase > // expected-error {{no template named 'UnknownBase'}} { }; template struct foo4 : UnknownBase >, // expected-error {{too few template arguments for class template 'ABC'}} Known // expected-error {{too few template arguments for class template 'Known'}} { }; template struct foo5 : UnknownBase> // expected-error {{no template named 'UnknownBase'}} #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif { }; template struct foo6 : UnknownBase>, // expected-error {{no template named 'UnknownBase'}} #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif Known // expected-error {{too few template arguments for class template 'Known'}} { }; template struct foo7 : UnknownBase1)> // expected-error {{no template named 'UnknownBase'}} { }; template struct foo8 : UnknownBase,X> // expected-error {{no template named 'UnknownBase'}} #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif { }; template struct foo9 : UnknownBase,X> // expected-error {{no template named 'UnknownBase'}} #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif { }; template struct foo10 : UnknownBase,X>> // expected-error {{no template named 'UnknownBase'}} #if __cplusplus <= 199711L // expected-error@-2 {{use '> >'}} #endif { }; template struct foo11 : UnknownBase<2 // expected-error {{no template named 'UnknownBase'}} { }; } namespace PR18793 { template struct S {}; template int g(S *); } namespace r360308_regression { template struct S1 { static int const n = 0; }; template struct S2 { typedef int t; }; template struct S3 { typename S2::n < 0, int>::t n; }; template bool f(FT p) { const bool a = p.firstFT(0); return a == b; } }