Replace completely bogus ambiguous-compound-literal-in-C++ code with something

that isn't always wrong.

llvm-svn: 208844
This commit is contained in:
Richard Smith 2014-05-15 02:51:15 +00:00
parent 87e11a426d
commit aba8b36abf
2 changed files with 7 additions and 3 deletions

View File

@ -2998,8 +2998,10 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
if (ParseAs == CompoundLiteral) {
ExprType = CompoundLiteral;
// FIXME: This is entirely wrong.
TypeResult Ty = ParseTypeName();
if (DeclaratorInfo.isInvalidType())
return ExprError();
TypeResult Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
return ParseCompoundLiteralExpression(Ty.get(),
Tracker.getOpenLocation(),
Tracker.getCloseLocation());

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -x c++ %s
// expected-no-diagnostics
int main() {
char *s;
s = (char []){"whatever"};
s = (char []){"whatever"};
s = (char(*)){s};
}