Add workaround to get test/Parser/compound_literal.c working again.

llvm-svn: 44666
This commit is contained in:
Anders Carlsson 2007-12-06 20:10:20 +00:00
parent 227c0d13bc
commit 10c6110fca
1 changed files with 9 additions and 3 deletions

View File

@ -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);
}