https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106276
Bug ID: 106276 Summary: Missing -Wpessimizing-move warning Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- Looks like we're missing a warning on the std::move line here: namespace std { template <typename _Tp> _Tp &&move(_Tp &&); } char take_buffer; struct label_text { label_text take() { return std::move(label_text(&take_buffer)); } label_text(char *); }; $ xclang++ -c -Wall -W line-map.ii line-map.ii:6:30: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] label_text take() { return std::move(label_text(&take_buffer)); } ^ line-map.ii:6:30: note: remove std::move call here label_text take() { return std::move(label_text(&take_buffer)); } ^~~~~~~~~~ ~ $ xg++ -c -Wall -W line-map.ii $