From 357b6fd3e5db431068f4922293de2b7fc346fcd4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 18 Dec 2009 05:19:44 +0000 Subject: [PATCH] Address some of Anders comments llvm-svn: 91670 --- clang/lib/CodeGen/CGCXX.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 21f3e00ac07b..011257b7499f 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/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);