https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87882
Bug ID: 87882 Summary: -Wredundant-move false positive Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: its at cleroth dot com Target Milestone: --- Warning suggests to remove `std::move` on `Foo::Bar()` despite it producing different code: > #include <string> > struct Foo { > Foo Bar() { > return std::move(*this); > } > Foo Baz() { > return *this; > } > std::string s; > }; > void Move(Foo & f) > { > f = Foo{}.Bar(); > } > void NoMove(Foo & f) > { > f = Foo{}.Baz(); > }