From: Douglas Gregor Date: Fri, 18 Dec 2009 05:19:44 +0000 (+0000) Subject: Address some of Anders comments X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9657c443688998dc84915e841a10509017b209db;p=clang Address some of Anders comments git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91670 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 21f3e00ac0..011257b749 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -579,10 +579,14 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest, const Expr *Arg = E->getArg(0); if (const ImplicitCastExpr *ICE = dyn_cast(Arg)) { - if (isa(ICE->getSubExpr())) - Arg = cast(ICE->getSubExpr())->getSubExpr(); - } else if (const CXXBindTemporaryExpr *BindExpr = - dyn_cast(Arg)) + assert((ICE->getCastKind() == CastExpr::CK_NoOp || + ICE->getCastKind() == CastExpr::CK_ConstructorConversion) && + "Unknown implicit cast kind in constructor elision"); + Arg = ICE->getSubExpr(); + } + + if (const CXXBindTemporaryExpr *BindExpr = + dyn_cast(Arg)) Arg = BindExpr->getSubExpr(); EmitAggExpr(Arg, Dest, false);