Fix the AST tree so ir-gen can do the conversion via copy construction.
Fixed pr5050.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82783 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index a243b2c..76c64f4 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1113,7 +1113,9 @@
if (SCS.CopyConstructor) {
// FIXME: When can ToType be a reference type?
assert(!ToType->isReferenceType());
-
+ if (SCS.Second == ICK_Derived_To_Base)
+ ImpCastExprToType(From, ToType, CastExpr::CK_DerivedToBase,
+ /*isLvalue=*/true);
OwningExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
ToType, SCS.CopyConstructor,