[cfe-commits] r69661 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/const-eval.c
Chris Lattner
sabre at nondot.org
Mon Apr 20 22:19:12 PDT 2009
Author: lattner
Date: Tue Apr 21 00:19:11 2009
New Revision: 69661
URL: http://llvm.org/viewvc/llvm-project?rev=69661&view=rev
Log:
Fix PR4027 + rdar://6808859, we were rejecting implicit casts of
aggregates even though we already accept explicit ones. Easy fix.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/Sema/const-eval.c
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=69661&r1=69660&r2=69661&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Apr 21 00:19:11 2009
@@ -1064,6 +1064,7 @@
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
Modified: cfe/trunk/test/Sema/const-eval.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=69661&r1=69660&r2=69661&view=diff
==============================================================================
--- cfe/trunk/test/Sema/const-eval.c (original)
+++ cfe/trunk/test/Sema/const-eval.c Tue Apr 21 00:19:11 2009
@@ -55,3 +55,9 @@
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};
More information about the cfe-commits
mailing list