This warning will catch:
- Using std::move in a return where the moved object is a local variable
- Using std::move on a pr-value object
struct A {}
A test() {
A a = std::move(A()); // warn since A() is a pr-value
return std::move(a); // warn since a is a local variable
}
This check is not especially cheap, and the code below will be cheap in most cases; it's probably better to omit this.