This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/87029, Implement -Wredundant-move
On Thu, Aug 23, 2018 at 10:44:30AM -0400, Marek Polacek wrote:
> +T
> +fn3 (const T t)
> +{
> + // t is const: will decay into move.
> + return t;
> +}
> +
> +T
> +fn4 (const T t)
> +{
> + // t is const: will decay into move despite std::move, so it's redundant.
> + return std::move (t); // { dg-warning "redundant move in return statement" }
> +}
This should read "decay into copy". We can't move from a const object. Consider
it fixed.
Marek