aboutsummaryrefslogtreecommitdiff
path: root/test/FixIt
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/FixIt
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/FixIt')
-rw-r--r--test/FixIt/fixit.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 6a081e745b..68ede1e43b 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -260,3 +260,34 @@ bool Foo::isGood() { // expected-error {{out-of-line definition of 'isGood' does
}
void Foo::beEvil() {} // expected-error {{out-of-line definition of 'beEvil' does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 'BeEvil'?}}
}
+
+// 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 '> =')}}
+
+ // FIXME: The fix-its here overlap so -fixit mode can't apply the second one.
+ //void f(S<S<int>>=S<int>());
+
+ struct Shr {
+ template<typename T> Shr(T);
+ template<typename T> void operator >>=(T);
+ };
+
+ template<template<typename>> struct TemplateTemplateParam; // expected-error {{requires 'class'}}
+
+ 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 '> >'}}
+ (Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}}
+
+ // FIXME: We correct this to '&t<int> > >= p;' not '&t<int> >>= p;'
+ //(Shr)&t<int>>>=p;
+
+ // FIXME: The fix-its here overlap.
+ //(void)(&t<S<int>>==p);
+ }
+}