https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89780

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The warning warns about dubious uses of std::move, so in the noMove case we
won't warn at all since there's no std::move.
In the withMove case, in C++20, we issue:
warning: moving a local object in a return statement prevents copy elision
for
template Dest withMove<Dest>();
and:
warning: redundant move in return statement
for
template Dest withMove<Source>();

In C++17, we issue one (wrong) warning, as originally reported.

With my patch, we won't issue any warnings, because I'm not sure if we can say
that in *any* instantiation of withMove the std::move is wrong.  Am I mistaken?

Thanks for your comments and sorry if I'm still not getting your point.

Reply via email to