https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159
Bug ID: 81159 Summary: New warning idea: -Wself-move Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: simon.marchi at polymtl dot ca Target Milestone: --- clang has this warning, -Wself-move, which warns about things like this: int a = 1; a = std::move (a); I don't see any reason why code like this would be desirable, so any code that ends up like this would likely be a mistake. It would be nice to point it out. Example output: test.c:6:4: error: explicitly moving variable of type 'int' to itself [-Werror,-Wself-move] a = std::move(a); ~ ^ ~ 1 error generated.