diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 177d0a4be781..4315915c1661 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -249,11 +249,6 @@ void AggExprEmitter::VisitOpaqueValueExpr(OpaqueValueExpr *e) { } void AggExprEmitter::VisitCastExpr(CastExpr *E) { - if (Dest.isIgnored() && E->getCastKind() != CK_Dynamic) { - Visit(E->getSubExpr()); - return; - } - switch (E->getCastKind()) { case CK_Dynamic: { assert(isa(E) && "CK_Dynamic without a dynamic_cast?"); @@ -270,6 +265,8 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { } case CK_ToUnion: { + if (Dest.isIgnored()) break; + // GCC union extension QualType Ty = E->getSubExpr()->getType(); QualType PtrTy = CGF.getContext().getPointerType(Ty); diff --git a/clang/test/CodeGenObjC/property-agrr-getter.m b/clang/test/CodeGenObjC/property-agrr-getter.m index 2dd32bb4f373..6d8f1d6b03ad 100644 --- a/clang/test/CodeGenObjC/property-agrr-getter.m +++ b/clang/test/CodeGenObjC/property-agrr-getter.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm-only %s typedef struct { unsigned f0; @@ -36,3 +36,9 @@ float f () AnObject* obj; return (obj.size).width; } + +// rdar://problem/9272392 +void test3(AnObject *obj) { + obj.size; + (void) obj.size; +}