summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-05-15 02:51:15 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-05-15 02:51:15 +0000
commitaba8b36abf58b090b4590900f69001edce4bd998 (patch)
treea408a39da2094cc37d274aef8840bb92462b8fe1 /clang
parent87e11a426dd5b36e2183db7885ee135922c5bfa8 (diff)
downloadbcm5719-llvm-aba8b36abf58b090b4590900f69001edce4bd998.tar.gz
bcm5719-llvm-aba8b36abf58b090b4590900f69001edce4bd998.zip
Replace completely bogus ambiguous-compound-literal-in-C++ code with something
that isn't always wrong. llvm-svn: 208844
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp6
-rw-r--r--clang/test/Parser/compound_literal.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index f1d6c8d6428..26ff273705b 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -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());
diff --git a/clang/test/Parser/compound_literal.c b/clang/test/Parser/compound_literal.c
index 9a0e4a64a65..00544996e3c 100644
--- a/clang/test/Parser/compound_literal.c
+++ b/clang/test/Parser/compound_literal.c
@@ -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};
}
OpenPOWER on IntegriCloud