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

that isn't always wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Smith 2014-05-15 02:51:15 +00:00
parent ae2d06735f
commit 537ec10ebc
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};
}