Add support for initializing char arrays from string literals.
Adapted from a patch by Anders Carlsson.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44816 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 3fa159e..5cf2745 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -689,15 +689,9 @@
//assert((InitExpr != 0) && "ActOnCompoundLiteral(): missing expression");
Expr *literalExpr = static_cast<Expr*>(InitExpr);
- // 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;
- }
+ // FIXME: add more semantic analysis (C99 6.5.2.5).
+ if (CheckInitializer(literalExpr, literalType, false))
+ return 0;
return new CompoundLiteralExpr(literalType, literalExpr);
}