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

2022-08-17 Thread Marek Polacek via Gcc-patches
On Mon, Aug 15, 2022 at 03:43:38PM -0400, Jason Merrill wrote: > On 8/8/22 13:27, Marek Polacek wrote: > > This is to warn about this: > > > > T f5(const T t) > > { > >return std::move(t); // { dg-warning "redundant move" } > > } > > > > where OR fails because there's no T(const T&&) (or it's

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

2022-08-15 Thread Jason Merrill via Gcc-patches
On 8/8/22 13:27, Marek Polacek wrote: On Sat, Aug 06, 2022 at 03:58:13PM -0800, Jason Merrill wrote: 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&

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

2022-08-09 Thread Marek Polacek via Gcc-patches
On Mon, Aug 08, 2022 at 04:27:10PM -0400, Marek Polacek wrote: > + /* Also try to warn about redundant std::move in code such as > + T f (const T& t) > + { > + return std::move(t); > + } > +for which EXPR will be something like > + *std::move ((const struct T &) (const

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

2022-08-08 Thread Marek Polacek via Gcc-patches
On Sat, Aug 06, 2022 at 03:58:13PM -0800, Jason Merrill wrote: > 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) > >{ > >