Eli Friedman | 64a4eb2 | 2009-12-27 22:31:18 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> struct A {}; |
| 4 | |
| 5 | // Check for template argument lists followed by junk |
| 6 | // FIXME: The diagnostics here aren't great... |
| 7 | A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}} |
John McCall | 9ba6166 | 2010-02-26 08:45:28 +0000 | [diff] [blame] | 8 | A<int x; // expected-error {{expected '>'}} |
Eli Friedman | 64a4eb2 | 2009-12-27 22:31:18 +0000 | [diff] [blame] | 9 | |
Douglas Gregor | bc61bd8 | 2011-01-11 00:33:19 +0000 | [diff] [blame] | 10 | // PR8912 |
| 11 | template <bool> struct S {}; |
| 12 | S<bool(2 > 1)> s; |
Richard Smith | 19a2702 | 2012-06-18 06:11:04 +0000 | [diff] [blame] | 13 | |
| 14 | // Test behavior when a template-id is ended by a token which starts with '>'. |
| 15 | namespace greatergreater { |
| 16 | template<typename T> struct S { S(); S(T); }; |
| 17 | void f(S<int>=0); // expected-error {{a space is required between a right angle bracket and an equals sign (use '> =')}} |
| 18 | void f(S<S<int>>=S<int>()); // expected-error {{use '> >'}} expected-error {{use '> ='}} |
| 19 | template<typename T> void t(); |
| 20 | void g() { |
| 21 | void (*p)() = &t<int>; |
| 22 | (void)(&t<int>==p); // expected-error {{use '> ='}} |
| 23 | (void)(&t<int>>=p); // expected-error {{use '> >'}} |
| 24 | (void)(&t<S<int>>>=p); // expected-error {{use '> >'}} |
| 25 | (void)(&t<S<int>>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}} |
| 26 | } |
| 27 | } |