diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-21 05:19:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-21 05:19:11 +0000 |
commit | 1f02e054a93a6332d7e946dc10a39df60cdd8492 (patch) | |
tree | 7ea78533da82e9f1bc7695da946c04470a059b33 | |
parent | 16f11c73198d1621f59c4eeb3f311419d81c8689 (diff) | |
download | bcm5719-llvm-1f02e054a93a6332d7e946dc10a39df60cdd8492.tar.gz bcm5719-llvm-1f02e054a93a6332d7e946dc10a39df60cdd8492.zip |
Fix PR4027 + rdar://6808859, we were rejecting implicit casts of
aggregates even though we already accept explicit ones. Easy fix.
llvm-svn: 69661
-rw-r--r-- | clang/lib/AST/Expr.cpp | 1 | ||||
-rw-r--r-- | clang/test/Sema/const-eval.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 46dce59d3e9..970d2951921 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -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 diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c index dd91c482365..08daa5f8d6e 100644 --- a/clang/test/Sema/const-eval.c +++ b/clang/test/Sema/const-eval.c @@ -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}; |