]> granicus.if.org Git - clang/commitdiff
Add workaround to get test/Parser/compound_literal.c working again.
authorAnders Carlsson <andersca@mac.com>
Thu, 6 Dec 2007 20:10:20 +0000 (20:10 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 6 Dec 2007 20:10:20 +0000 (20:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44666 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp

index ed719346215e354cec5246341b55184cc1c53d15..379a033d418830f8b37e9fb532eae8c5723c6cec 100644 (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);
 }