If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81383 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 969b789..dde6899 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1158,19 +1158,11 @@
 /// all the reasons that casts are permitted with aggregate result, including
 /// noop aggregate casts, and cast from scalar to union.
 LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
-  if (E->getCastKind() == CastExpr::CK_UserDefinedConversion) {
-    if (const CXXFunctionalCastExpr *CXXFExpr =
-          dyn_cast<CXXFunctionalCastExpr>(E))
-      return  LValue::MakeAddr(
-                EmitCXXFunctionalCastExpr(CXXFExpr).getScalarVal(), 0);
-    assert(isa<CStyleCastExpr>(E) &&
-           "EmitCastLValue - Expected CStyleCastExpr");
-    return EmitLValue(E->getSubExpr());
-  }
-
   // If this is an aggregate-to-aggregate cast, just use the input's address as
   // the lvalue.
-  if (E->getCastKind() == CastExpr::CK_NoOp)
+  if (E->getCastKind() == CastExpr::CK_NoOp ||
+      E->getCastKind() == CastExpr::CK_ConstructorConversion ||
+      E->getCastKind() == CastExpr::CK_UserDefinedConversion)
     return EmitLValue(E->getSubExpr());
 
   // If this is an lvalue cast, treat it as a no-op.