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
This commit is contained in:
David Majnemer 2014-12-15 07:00:05 +00:00
parent a47ae907e8
commit ecabbc52d5
2 changed files with 6 additions and 1 deletions

View File

@ -339,7 +339,7 @@ private:
void UnconsumeToken(Token &Consumed) {
Token Next = Tok;
PP.EnterToken(Consumed);
ConsumeToken();
PP.Lex(Tok);
PP.EnterToken(Next);
}

View File

@ -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_;}