diff options
-rw-r--r-- | clang/CodeGen/CGExprAgg.cpp | 12 | ||||
-rw-r--r-- | clang/test/CodeGen/struct.c | 15 |
2 files changed, 26 insertions, 1 deletions
diff --git a/clang/CodeGen/CGExprAgg.cpp b/clang/CodeGen/CGExprAgg.cpp index 5470e7f9f57..5836262175f 100644 --- a/clang/CodeGen/CGExprAgg.cpp +++ b/clang/CodeGen/CGExprAgg.cpp @@ -70,8 +70,8 @@ public: // Operators. // case Expr::UnaryOperatorClass: - // case Expr::ImplicitCastExprClass: // case Expr::CastExprClass: + void VisitImplicitCastExpr(ImplicitCastExpr *E); void VisitCallExpr(const CallExpr *E); void VisitStmtExpr(const StmtExpr *E); void VisitBinaryOperator(const BinaryOperator *BO); @@ -137,6 +137,16 @@ void AggExprEmitter::EmitAggLoadOfLValue(const Expr *E) { // Visitor Methods //===----------------------------------------------------------------------===// +void AggExprEmitter::VisitImplicitCastExpr(ImplicitCastExpr *E) +{ + QualType STy = E->getSubExpr()->getType().getCanonicalType(); + QualType Ty = E->getType().getCanonicalType(); + + assert(STy == Ty && "Implicit cast types must be equal"); + + Visit(E->getSubExpr()); +} + void AggExprEmitter::VisitCallExpr(const CallExpr *E) { RValue RV = CGF.EmitCallExpr(E); diff --git a/clang/test/CodeGen/struct.c b/clang/test/CodeGen/struct.c index a52e538a7f6..8f9ecd6080a 100644 --- a/clang/test/CodeGen/struct.c +++ b/clang/test/CodeGen/struct.c @@ -112,3 +112,18 @@ struct _w _Bool j,k; } ws; + +/* Implicit casts (due to typedefs) */ +typedef struct _a +{ + int a; +} a; + +void f11() +{ + struct _a a1; + a a2; + + a1 = a2; + a2 = a1; +} |