Re: [PATCH] c++: Extend -Wredundant-move for const-qual objects [PR90428]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 8/6/22 11:13, Marek Polacek wrote: In this PR, Jon suggested extending the -Wredundant-move warning to warn when the user is moving a const object as in: struct T { }; T f(const T& t) { return std::move(t); } where the std::move is redundant, because T does not have a T(con

[PATCH] c++: Extend -Wredundant-move for const-qual objects [PR90428]

2022-08-06 Thread Marek Polacek via Gcc-patches
In this PR, Jon suggested extending the -Wredundant-move warning to warn when the user is moving a const object as in: struct T { }; T f(const T& t) { return std::move(t); } where the std::move is redundant, because T does not have a T(const T&&) constructor (which is very unlikely).