Why is this an issue?
By specification, objects supporting move operations will be left in a valid but unspecified state after the move. Even if in a valid state, the
fact of being in an unspecified state leads to undefined behavior, you should not rely on their value.
Noncompliant code example
void f() {
A a;
A a2 = std::move(a);
a.fun(); // Noncompliant, a is moved-from
}
Compliant solution
void f() {
A a;
A a2 = std::move(a);
a2.fun();
}
Resources