summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-15 07:00:05 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-15 07:00:05 +0000
commitecabbc52d51a737ae9964190933c7a0abcff3b21 (patch)
treec752f88e9bb8d5ac5b54ab935d30e23679241b7d
parenta47ae907e83a36b0c79a017fb3a9eeaee11b0dee (diff)
downloadbcm5719-llvm-ecabbc52d51a737ae9964190933c7a0abcff3b21.tar.gz
bcm5719-llvm-ecabbc52d51a737ae9964190933c7a0abcff3b21.zip
Parse: Don't reorder tokens using ConsumeToken
ConsumeToken doesn't work with special tokens. Instead, just use PP.Lex to eat the token. This fixes PR21817. llvm-svn: 224232
-rw-r--r--clang/include/clang/Parse/Parser.h2
-rw-r--r--clang/test/SemaCXX/typo-correction.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 307446c3427..ba5c946d359 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -339,7 +339,7 @@ private:
void UnconsumeToken(Token &Consumed) {
Token Next = Tok;
PP.EnterToken(Consumed);
- ConsumeToken();
+ PP.Lex(Tok);
PP.EnterToken(Next);
}
diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp
index 4f1928365f8..3b31b8db798 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -4,6 +4,11 @@
// afoul the hard-coded limit (escape hatch) of 20 different typos whose
// correction was attempted by Sema::CorrectTypo
+namespace PR21817{
+int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}}
+ // expected-error@-1 {{expected expression}}
+}
+
struct errc {
int v_;
operator int() const {return v_;}
OpenPOWER on IntegriCloud