https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:0abb78dda084a14b3d955757c6431fff71c263f3 commit r13-2227-g0abb78dda084a14b3d955757c6431fff71c263f3 Author: Marek Polacek <pola...@redhat.com> Date: Mon Aug 8 17:45:28 2022 -0400 c++: Implement -Wself-move warning [PR81159] About 5 years ago we got a request to implement -Wself-move, which warns about useless moves like this: int x; x = std::move (x); This patch implements that warning. PR c++/81159 gcc/c-family/ChangeLog: * c.opt (Wself-move): New option. gcc/cp/ChangeLog: * typeck.cc (maybe_warn_self_move): New. (cp_build_modify_expr): Call maybe_warn_self_move. gcc/ChangeLog: * doc/invoke.texi: Document -Wself-move. gcc/testsuite/ChangeLog: * g++.dg/warn/Wself-move1.C: New test.