https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107697
Bug ID: 107697 Summary: -Wredundant-move misses std::move applied to const objects (instead of const references) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dangelog at gmail dot com Target Milestone: --- Hi, Consider this testcase: #include <vector> using T = std::vector<int>; void f(T); void use1(const T t) { f(std::move(t)); } void use2(const T &t) { f(std::move(t)); } void use3() { const T t; f(std::move(t)); } Currently -Wredundant-move warns only for case 2. But in all three cases std::move is actually not doing anything good (copy constructor is always selected). It would be nice if they all were diagnosed. If I change `f` to `void f(const T &)` then there's no warning at all. I'm thinking that probably this case should be diagnosed as well. Clang-tidy's performance-move-const-arg diagnoses them all.