[cfe-commits] r44666 - /cfe/trunk/Sema/SemaExpr.cpp

Anders Carlsson andersca at mac.com
Thu Dec 6 12:10:21 PST 2007


Author: andersca
Date: Thu Dec  6 14:10:20 2007
New Revision: 44666

URL: http://llvm.org/viewvc/llvm-project?rev=44666&view=rev
Log:
Add workaround to get test/Parser/compound_literal.c working again.

Modified:
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=44666&r1=44665&r2=44666&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Dec  6 14:10:20 2007
@@ -689,9 +689,15 @@
   //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);
 }





More information about the cfe-commits mailing list