diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 8dd747240a..4253d18c39 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -309,9 +309,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest, if (getContext().getLangOptions().ElideConstructors && E->isElidable()) { const Expr *Arg = E->getArg(0); - // FIXME: This 'while' statement should really be an 'if' statement, it's - // added as a workaround for PR6199. - while (const ImplicitCastExpr *ICE = dyn_cast(Arg)) { + if (const ImplicitCastExpr *ICE = dyn_cast(Arg)) { assert((ICE->getCastKind() == CastExpr::CK_NoOp || ICE->getCastKind() == CastExpr::CK_ConstructorConversion || ICE->getCastKind() == CastExpr::CK_UserDefinedConversion) && diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 1938e3dfb5..b1b85e5928 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -4808,6 +4808,12 @@ TreeTransform::TransformDependentScopeDeclRefExpr( template Sema::OwningExprResult TreeTransform::TransformCXXConstructExpr(CXXConstructExpr *E) { + // CXXConstructExprs are always implicit, so when we have a + // 1-argument construction we just transform that argument. + if (E->getNumArgs() == 1 || + (E->getNumArgs() > 1 && getDerived().DropCallArgument(E->getArg(1)))) + return getDerived().TransformExpr(E->getArg(0)); + TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName()); QualType T = getDerived().TransformType(E->getType());