diff options
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/cast-emit.c | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 97455c7b13..ac189a0649 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -189,7 +189,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { CGF.ConvertType(PtrTy)); EmitInitializationToLValue(E->getSubExpr(), LValue::MakeAddr(CastPtr, Qualifiers()), - E->getType()); + E->getSubExpr()->getType()); break; } diff --git a/test/CodeGen/cast-emit.c b/test/CodeGen/cast-emit.c new file mode 100644 index 0000000000..4e33fa32f7 --- /dev/null +++ b/test/CodeGen/cast-emit.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +typedef union { + int i; + float f; +} MyUnion; +void unionf(MyUnion a); +void uniontest(float a) { + f((MyUnion)1.0f); +// CHECK: store float 1.000000e+00 +} + |