Fix Parser::isCXXConditionDeclaration to properly resolve declarations.

llvm-svn: 57111
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 95512a6..1209b57 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -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;
 }
diff --git a/clang/test/SemaCXX/decl-expr-ambiguity.cpp b/clang/test/SemaCXX/decl-expr-ambiguity.cpp
index 5b4ddbe..7c274de 100644
--- a/clang/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/clang/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -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) {}
 }