https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87029

            Bug ID: 87029
           Summary: Add -Wredundant-move
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Similarly to 86981, we could also warn here about the redundant (but not
pessimizing) move here:

#include <utility>

struct S { };

S
foo (S s)
{
  return std::move (s);
}

the compiler will try a move operation regardless the std::move (if the move
ctor is present and accessible).
Unless the parameter is const, of course.

Reply via email to