[cfe-commits] r57111 - in /cfe/trunk: lib/Parse/ParseTentative.cpp test/SemaCXX/decl-expr-ambiguity.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Sun Oct 5 08:19:51 PDT 2008
Author: akirtzidis
Date: Sun Oct 5 10:19:49 2008
New Revision: 57111
URL: http://llvm.org/viewvc/llvm-project?rev=57111&view=rev
Log:
Fix Parser::isCXXConditionDeclaration to properly resolve declarations.
Modified:
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=57111&r1=57110&r2=57111&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Sun Oct 5 10:19:49 2008
@@ -259,11 +259,9 @@
// declarator
TPR = TryParseDeclarator(false/*mayBeAbstract*/);
- PA.Revert();
-
// In case of an error, let the declaration parsing code handle it.
if (TPR == TPR_error)
- return true;
+ TPR = TPR_true;
if (TPR == TPR_ambiguous) {
// '='
@@ -275,6 +273,8 @@
TPR = TPR_false;
}
+ PA.Revert();
+
assert(TPR == TPR_true || TPR == TPR_false);
return TPR == TPR_true;
}
Modified: cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp?rev=57111&r1=57110&r2=57111&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp Sun Oct 5 10:19:49 2008
@@ -19,4 +19,5 @@
typeof(int[])(f) = { 1, 2 }; // expected-warning {{statement was disambiguated as declaration}}
void(b)(int);
int(d2) __attribute__(()); // expected-warning {{statement was disambiguated as declaration}}
+ if (int(a)=1) {}
}
More information about the cfe-commits
mailing list