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
// direct-declarator: '(' declarator ')'
// direct-declarator: '(' attributes declarator ')'
if (isGrouping) {
+ bool hadGroupingParens = D.hasGroupingParens();
D.setGroupingParens(true);
if (Tok.is(tok::kw___attribute))
ParseDeclaratorInternal(D);
// Match the ')'.
MatchRHSPunctuation(tok::r_paren, StartLoc);
+
+ D.setGroupingParens(hadGroupingParens);
return;
}
-// RUN: clang -fsyntax-only %s
+// RUN: clang -fsyntax-only -verify %s
int x(1);
+int (x2)(1);
void f() {
int x(1);
+ int (x2)(1); // expected-warning {{statement was disambiguated as declaration}}
for (int x(1);;) {}
}