diff options
author | Anders Carlsson <andersca@mac.com> | 2007-12-06 20:10:20 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2007-12-06 20:10:20 +0000 |
commit | b2f08e06f02d8e7de60f6614472bc7a414c3a405 (patch) | |
tree | e8b42d5328a6f54d797742855a69d91d68111ee3 | |
parent | d0ee6f9f9a5bc5d85e7469f5aabf91f1e71b12f5 (diff) |
Add workaround to get test/Parser/compound_literal.c working again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44666 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Sema/SemaExpr.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index ed71934621..379a033d41 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -689,9 +689,15 @@ ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty, //assert((InitExpr != 0) && "ActOnCompoundLiteral(): missing expression"); Expr *literalExpr = static_cast<Expr*>(InitExpr); - // FIXME: add more semantic analysis (C99 6.5.2.5). - if (CheckInitializer(literalExpr, literalType, false)) - return 0; + // FIXME: This is just a temporary workaround to get + // test/Parser/compound_literal.c passing. (CheckInitializer does not support + // initializing a char array from a single string literal). + if (!literalType->isArrayType() || + !literalType->getAsArrayType()->getElementType()->isCharType()) { + // FIXME: add more semantic analysis (C99 6.5.2.5). + if (CheckInitializer(literalExpr, literalType, false)) + return 0; + } return new CompoundLiteralExpr(literalType, literalExpr); } |