Fix a bug where we'd try to look beyond the current cached tokens when

not in backtracking mode.  This was just using the wrong predicate.

llvm-svn: 61666
This commit is contained in:
Chris Lattner 2009-01-05 01:42:04 +00:00
parent f87d41d8b9
commit c69537feb5
3 changed files with 14 additions and 3 deletions

View File

@ -414,7 +414,7 @@ public:
/// invoked.
void AnnotateCachedTokens(const Token &Tok) {
assert(Tok.isAnnotationToken() && "Expected annotation token");
if (CachedLexPos != 0 && InCachingLexMode())
if (CachedLexPos != 0 && isBacktrackEnabled())
AnnotatePreviousCachedTokens(Tok);
}

View File

@ -68,8 +68,8 @@ bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS,
SourceLocation CCLoc = ConsumeToken();
// ::new and ::delete aren't nested-name-specifiers, and
// MaybeParseCXXScopeSpecifier is never called in a context where one could
// exist. This means that if we see it, we have a syntax error.
// MaybeParseCXXScopeSpecifier is never called in a context where one
// could exist. This means that if we see it, we have a syntax error.
if (Tok.is(tok::kw_new) || Tok.is(tok::kw_delete)) {
Diag(Tok, diag::err_invalid_qualified_new_delete)
<< Tok.is(tok::kw_delete);

View File

@ -53,3 +53,14 @@ void test_f1(int i) {
int v3 = ::i1;
}
typedef int f2_type;
namespace a {
typedef int f2_type(int, int);
void test_f2() {
::f2_type(1, 2); // expected-error {{function-style cast to a builtin type can only take one argument}}
}
}