]> granicus.if.org Git - clang/commitdiff
Fix PR4027 + rdar://6808859, we were rejecting implicit casts of
authorChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 05:19:11 +0000 (05:19 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 05:19:11 +0000 (05:19 +0000)
aggregates even though we already accept explicit ones.  Easy fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp
test/Sema/const-eval.c

index 46dce59d3e9d1536108cba04f05df86920f9d101..970d29519214d90e3797d8c36c22f8726952cd38 100644 (file)
@@ -1064,6 +1064,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx) const {
       return Exp->getSubExpr()->isConstantInitializer(Ctx);
     break;
   }
+  case ImplicitCastExprClass:
   case CStyleCastExprClass:
     // Handle casts with a destination that's a struct or union; this
     // deals with both the gcc no-op struct cast extension and the
index dd91c48236594944af3d37d08357fd9838ec8647..08daa5f8d6ee0f3cbfa915c6d4615b32532555ec 100644 (file)
@@ -55,3 +55,9 @@ EVAL_EXPR(26, (_Complex double)0 ? -1 : 1)
 EVAL_EXPR(27, (_Complex int)0 ? -1 : 1)
 EVAL_EXPR(28, (_Complex double)1 ? 1 : -1)
 EVAL_EXPR(29, (_Complex int)1 ? 1 : -1)
+
+
+// PR4027 + rdar://6808859
+struct a { int x, y };
+static struct a V2 = (struct a)(struct a){ 1, 2};
+static const struct a V1 = (struct a){ 1, 2};