https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88692
Bug ID: 88692
Summary: Spurious "redundant move in return statement"
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: d25fe0be at outlook dot com
Target Milestone: ---
From https://en.cppreference.com/w/cpp/language/member_functions:
> Note: unlike cv-qualification, ref-qualification does not change the
> properties of the this pointer: within a rvalue ref-qualified function, *this
> remains an lvalue expression.
But GCC reports "redundant move" when compiling the following snippet:
```
#include <utility>
struct X {
X f() && {
return std::move(*this);
}
};
```
Live example: https://wandbox.org/permlink/9sD1NnyoDWnKE92C