Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210
llvm-svn: 86234
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index a00dfb0..fa8e64d 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -381,13 +381,7 @@
OwningExprResult Result = ParseExpression();
// Match the ')'.
- if (Result.isInvalid())
- SkipUntil(tok::r_paren);
-
- if (Tok.is(tok::r_paren))
- RParenLoc = ConsumeParen();
- else
- MatchRHSPunctuation(tok::r_paren, LParenLoc);
+ RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
if (!Result.isInvalid() && !CastTy.isInvalid())
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,