Re: [PATCH] c++: Extend -Wpessimizing-move for class prvalues [PR106276]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 8/6/22 15:49, Jason Merrill wrote: On 7/27/22 17:14, Marek Polacek wrote: We already have a warning that warns about pessimizing std::move in a return statement, when it prevents the NRVO:    T fn()    { T t; return std::move (t); // warning \o/    } However, the warning doesn't w

Re: [PATCH] c++: Extend -Wpessimizing-move for class prvalues [PR106276]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 7/27/22 17:14, Marek Polacek wrote: We already have a warning that warns about pessimizing std::move in a return statement, when it prevents the NRVO: T fn() { T t; return std::move (t); // warning \o/ } However, the warning doesn't warn when what we are returning is a cla

[PATCH] c++: Extend -Wpessimizing-move for class prvalues [PR106276]

2022-07-27 Thread Marek Polacek via Gcc-patches
We already have a warning that warns about pessimizing std::move in a return statement, when it prevents the NRVO: T fn() { T t; return std::move (t); // warning \o/ } However, the warning doesn't warn when what we are returning is a class prvalue, that is, when std::move prevents t