In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
Fixes this bug:
int (x)(0); // error, expected function declarator where the '(0)' initializer is
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57241 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 7d1a9bb..c541a13 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1279,6 +1279,7 @@
// direct-declarator: '(' declarator ')'
// direct-declarator: '(' attributes declarator ')'
if (isGrouping) {
+ bool hadGroupingParens = D.hasGroupingParens();
D.setGroupingParens(true);
if (Tok.is(tok::kw___attribute))
@@ -1287,6 +1288,8 @@
ParseDeclaratorInternal(D);
// Match the ')'.
MatchRHSPunctuation(tok::r_paren, StartLoc);
+
+ D.setGroupingParens(hadGroupingParens);
return;
}