Fix Parser::isCXXConditionDeclaration to properly resolve declarations.

llvm-svn: 57111
This commit is contained in:
Argyrios Kyrtzidis 2008-10-05 15:19:49 +00:00
parent 37e560cde1
commit 2534620b4e
2 changed files with 4 additions and 3 deletions

View File

@ -259,11 +259,9 @@ bool Parser::isCXXConditionDeclaration() {
// 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 @@ bool Parser::isCXXConditionDeclaration() {
TPR = TPR_false;
}
PA.Revert();
assert(TPR == TPR_true || TPR == TPR_false);
return TPR == TPR_true;
}

View File

@ -19,4 +19,5 @@ void f() {
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) {}
}