When performing a derived-to-base cast on the right-hand side of the
synthesized move assignment within an implicitly-defined move
assignment operator, be sure to treat the derived-to-base cast as an
xvalue (rather than an lvalue). Otherwise, we'll end up getting the
wrong constructor.

Optimize a direct call to a trivial move assignment operator to an
aggregate copy, as we do for trivial copy assignment operators, and
update the the assertion in CodeGenFunction::EmitAggregateCopy() to
cope with this optimization.

Fixes PR10860.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139143 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed