Move constructor on derived object

rval is not a Rvalue. It is an Lvalue inside the body of the move constructor. That’s why we have to explicitly invoke std::move.

Refer this. The important note is

Note above that the argument x is
treated as an lvalue internal to the
move functions, even though it is
declared as an rvalue reference
parameter. That’s why it is necessary
to say move(x) instead of just x when
passing down to the base class. This
is a key safety feature of move
semantics designed to prevent
accidently moving twice from some
named variable. All moves occur only
from rvalues, or with an explicit cast
to rvalue such as using std::move. If
you have a name for the variable, it
is an lvalue.

Leave a Comment