]> granicus.if.org Git - clang/commitdiff
fix the more complex cases by actually codegen'ing the right expr :)
authorChris Lattner <sabre@nondot.org>
Wed, 18 Mar 2009 18:30:44 +0000 (18:30 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 18 Mar 2009 18:30:44 +0000 (18:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67219 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
test/CodeGen/exprs.c

index 93b2382166ac3ef99b4528aa6f996f444ee87219..95cb53c1f70d2c097b824acd95f99757b380963c 100644 (file)
@@ -1024,7 +1024,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
   
   // Casts are only lvalues when the source and destination types are the same.
   llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType()));
-  EmitAnyExpr(E, Temp, false);
+  EmitAnyExpr(E->getSubExpr(), Temp, false);
   
   return LValue::MakeAddr(Temp, E->getType().getCVRQualifiers(),
                           getContext().getObjCGCAttrKind(E->getType()));
index a0fe96008952b9f32f109cfe7721a04549c4b0f5..dbc14997d4e4d3d099d7dbab06aa4d957d74b4fd 100644 (file)
@@ -82,3 +82,9 @@ unsigned f1(void) {
 union f3_x {int x; float y;};
 int f3() {return ((union f3_x)2).x;}
 
+union f4_y {int x; _Complex float y;};
+_Complex float f4() {return ((union f4_y)(_Complex float)2.0).y;}
+
+struct f5_a { int a; } f5_a;
+union f5_z {int x; struct f5_a y;};
+struct f5_a f5() {return ((union f5_z)f5_a).y;}