summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
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
commit7b3f322517c2e026d2326e49ecf9bef1edb6e59d (patch)
tree830897573c6007a76fb02391160a36dcb0d83d67 /clang/test/Parser
parent5c98e1fb24808978911ba2af44bce0401e12da34 (diff)
downloadbcm5719-llvm-7b3f322517c2e026d2326e49ecf9bef1edb6e59d.tar.gz
bcm5719-llvm-7b3f322517c2e026d2326e49ecf9bef1edb6e59d.zip
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. llvm-svn: 158652
Diffstat (limited to 'clang/test/Parser')
-rw-r--r--clang/test/Parser/cuda-kernel-call.cu7
-rw-r--r--clang/test/Parser/cxx-template-argument.cpp15
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Parser/cuda-kernel-call.cu b/clang/test/Parser/cuda-kernel-call.cu
index f95ae9e6195..92e46e3acaf 100644
--- a/clang/test/Parser/cuda-kernel-call.cu
+++ b/clang/test/Parser/cuda-kernel-call.cu
@@ -1,9 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename> struct S {};
+template<typename> void f();
+
void foo(void) {
foo<<<1; // expected-error {{expected '>>>'}} expected-note {{to match this '<<<'}}
foo<<<1,1>>>; // expected-error {{expected '('}}
foo<<<>>>(); // expected-error {{expected expression}}
+
+ S<S<S<int>>> s; // expected-error 2{{use '> >'}}
+
+ (void)(&f<S<S<int>>>==0); // expected-error 2{{use '> >'}}
}
diff --git a/clang/test/Parser/cxx-template-argument.cpp b/clang/test/Parser/cxx-template-argument.cpp
index c85b1c92811..5479961d563 100644
--- a/clang/test/Parser/cxx-template-argument.cpp
+++ b/clang/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 '> ='}}
+ }
+}
OpenPOWER on IntegriCloud