forked from OSchip/llvm-project
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:
parent
f87d41d8b9
commit
c69537feb5
|
@ -414,7 +414,7 @@ public:
|
||||||
/// invoked.
|
/// invoked.
|
||||||
void AnnotateCachedTokens(const Token &Tok) {
|
void AnnotateCachedTokens(const Token &Tok) {
|
||||||
assert(Tok.isAnnotationToken() && "Expected annotation token");
|
assert(Tok.isAnnotationToken() && "Expected annotation token");
|
||||||
if (CachedLexPos != 0 && InCachingLexMode())
|
if (CachedLexPos != 0 && isBacktrackEnabled())
|
||||||
AnnotatePreviousCachedTokens(Tok);
|
AnnotatePreviousCachedTokens(Tok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
SourceLocation CCLoc = ConsumeToken();
|
SourceLocation CCLoc = ConsumeToken();
|
||||||
|
|
||||||
// ::new and ::delete aren't nested-name-specifiers, and
|
// ::new and ::delete aren't nested-name-specifiers, and
|
||||||
// MaybeParseCXXScopeSpecifier is never called in a context where one could
|
// MaybeParseCXXScopeSpecifier is never called in a context where one
|
||||||
// exist. This means that if we see it, we have a syntax error.
|
// 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)) {
|
if (Tok.is(tok::kw_new) || Tok.is(tok::kw_delete)) {
|
||||||
Diag(Tok, diag::err_invalid_qualified_new_delete)
|
Diag(Tok, diag::err_invalid_qualified_new_delete)
|
||||||
<< Tok.is(tok::kw_delete);
|
<< Tok.is(tok::kw_delete);
|
||||||
|
|
|
@ -53,3 +53,14 @@ void test_f1(int i) {
|
||||||
int v3 = ::i1;
|
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}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue