Re: [PATCH 5/9] Change decode_compound_collector to use std::vector

Simon Marchi
2018-08-20T14:03:40Z

On 2018-08-20 09:28, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> I've always read that it was bad to use std::move on a return
> value:
> Simon>
> https://diego.assencio.com/?index=f57f25fd5a187c70fc7f34fcf5374773
> Simon> though in this case it seems like the right thing to do.
>
> It would be nice if gcc warned when a std::move was either redundant or
> recommended. Maybe this is
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86981
>
> ... I thought I heard that clang 8 has a new warning in this area but I
> couldn't find it anywhere online, only a hint here:
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=1483985
>
> So I'm not really sure how to file this.
>
> Tom

Ah ok, but at least the wording of the warning confirms that this case
here is fine:

moving a local object in a return statement prevents copy elision

Here, we are not moving a local object.

Simon