ParseAs = CompoundLiteral;
} else {
bool NotCastExpr;
- // Try parsing the cast-expression that may follow.
- // If it is not a cast-expression, NotCastExpr will be true and no token
- // will be consumed.
- Result = ParseCastExpression(false/*isUnaryExpression*/,
- false/*isAddressofOperand*/,
- NotCastExpr);
+ // FIXME: Special-case ++ and --: "(S())++;" is not a cast-expression
+ if (Tok.is(tok::l_paren) && NextToken().is(tok::r_paren)) {
+ NotCastExpr = true;
+ } else {
+ // Try parsing the cast-expression that may follow.
+ // If it is not a cast-expression, NotCastExpr will be true and no token
+ // will be consumed.
+ Result = ParseCastExpression(false/*isUnaryExpression*/,
+ false/*isAddressofOperand*/,
+ NotCastExpr);
+ }
// If we parsed a cast-expression, it's really a type-id, otherwise it's
// an expression.
typedef int *PT;
// Make sure stuff inside the parens are parsed only once (only one warning).
x = (PT()[(int){1}]); // expected-warning {{compound literals}}
+
+ // Special case: empty parens is a call, not an expression
+ struct S{int operator()();};
+ (S())();
+
+ // FIXME: Special case: "++" is postfix here, not prefix
+ // (S())++;
}