r208844 - Replace completely bogus ambiguous-compound-literal-in-C++ code with something
Richard Smith
richard-llvm at metafoo.co.uk
Wed May 14 19:51:15 PDT 2014
Author: rsmith
Date: Wed May 14 21:51:15 2014
New Revision: 208844
URL: http://llvm.org/viewvc/llvm-project?rev=208844&view=rev
Log:
Replace completely bogus ambiguous-compound-literal-in-C++ code with something
that isn't always wrong.
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/Parser/compound_literal.c
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=208844&r1=208843&r2=208844&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed May 14 21:51:15 2014
@@ -2998,8 +2998,10 @@ Parser::ParseCXXAmbiguousParenExpression
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());
Modified: cfe/trunk/test/Parser/compound_literal.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/compound_literal.c?rev=208844&r1=208843&r2=208844&view=diff
==============================================================================
--- cfe/trunk/test/Parser/compound_literal.c (original)
+++ cfe/trunk/test/Parser/compound_literal.c Wed May 14 21:51:15 2014
@@ -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};
}
More information about the cfe-commits
mailing list