2009-12-28 06:31:18 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
template<typename T> struct A {};
|
|
|
|
|
|
|
|
// Check for template argument lists followed by junk
|
|
|
|
// FIXME: The diagnostics here aren't great...
|
|
|
|
A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}}
|
2010-02-26 16:45:28 +08:00
|
|
|
A<int x; // expected-error {{expected '>'}}
|
2009-12-28 06:31:18 +08:00
|
|
|
|
2011-01-11 08:33:19 +08:00
|
|
|
// PR8912
|
|
|
|
template <bool> struct S {};
|
|
|
|
S<bool(2 > 1)> s;
|
2012-06-18 14:11:04 +08:00
|
|
|
|
|
|
|
// Test behavior when a template-id is ended by a token which starts with '>'.
|
|
|
|
namespace greatergreater {
|
|
|
|
template<typename T> struct S { S(); S(T); };
|
|
|
|
void f(S<int>=0); // expected-error {{a space is required between a right angle bracket and an equals sign (use '> =')}}
|
|
|
|
void f(S<S<int>>=S<int>()); // expected-error {{use '> >'}} expected-error {{use '> ='}}
|
|
|
|
template<typename T> void t();
|
|
|
|
void g() {
|
|
|
|
void (*p)() = &t<int>;
|
|
|
|
(void)(&t<int>==p); // expected-error {{use '> ='}}
|
|
|
|
(void)(&t<int>>=p); // expected-error {{use '> >'}}
|
|
|
|
(void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
|
|
|
|
(void)(&t<S<int>>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}}
|
|
|
|
}
|
|
|
|
}
|
2012-08-18 08:55:03 +08:00
|
|
|
|
|
|
|
namespace PR5925 {
|
|
|
|
template <typename x>
|
|
|
|
class foo { // expected-note {{here}}
|
|
|
|
};
|
|
|
|
void bar(foo *X) { // expected-error {{requires template arguments}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace PR13210 {
|
|
|
|
template <class T>
|
|
|
|
class C {}; // expected-note {{here}}
|
|
|
|
|
|
|
|
void f() {
|
|
|
|
new C(); // expected-error {{requires template arguments}}
|
|
|
|
}
|
|
|
|
}
|