aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-template-argument.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-06-18 06:11:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-06-18 06:11:04 +0000
commit19a2702042b7e3ee838cca458b35f607111a3897 (patch)
treebad920c4a3694b180ea40b73328a232cc14ef81f /test/Parser/cxx-template-argument.cpp
parent7e58ad5a6756f31b48a0d54d5f5c367328150a46 (diff)
Extend the error recovery for a template-argument-list terminated by '>>' to
also deal with '>>>' (in CUDA), '>=', and '>>='. Fix the FixItHints logic to deal with cases where the token is followed by an adjacent '=', '==', '>=', '>>=', or '>>>' token, where a naive fix-it would result in a differing token stream on a re-lex. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-template-argument.cpp')
-rw-r--r--test/Parser/cxx-template-argument.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp
index c85b1c9281..5479961d56 100644
--- a/test/Parser/cxx-template-argument.cpp
+++ b/test/Parser/cxx-template-argument.cpp
@@ -10,3 +10,18 @@ A<int x; // expected-error {{expected '>'}}
// PR8912
template <bool> struct S {};
S<bool(2 > 1)> s;
+
+// 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 '> ='}}
+ }
+}