summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 01:42:04 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 01:42:04 +0000
commitc69537feb5261ca1f3f977445f65e0bdf0c9a31f (patch)
tree3aafd7205f3f21fda4f9057f97cc0ec4c255ccd8
parentf87d41d8b9f8cd8b1095dfe92c58ca4323720c0f (diff)
downloadbcm5719-llvm-c69537feb5261ca1f3f977445f65e0bdf0c9a31f.tar.gz
bcm5719-llvm-c69537feb5261ca1f3f977445f65e0bdf0c9a31f.zip
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
-rw-r--r--clang/include/clang/Lex/Preprocessor.h2
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp4
-rw-r--r--clang/test/SemaCXX/qualified-id-lookup.cpp11
3 files changed, 14 insertions, 3 deletions
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index efe057e3347..54dc1b62df0 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -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);
}
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index a4b97e173be..5e50bf88594 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -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);
diff --git a/clang/test/SemaCXX/qualified-id-lookup.cpp b/clang/test/SemaCXX/qualified-id-lookup.cpp
index d0bb338e873..064f5c90934 100644
--- a/clang/test/SemaCXX/qualified-id-lookup.cpp
+++ b/clang/test/SemaCXX/qualified-id-lookup.cpp
@@ -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}}
+ }
+}
+
+
+
OpenPOWER on IntegriCloud