It may also be reasonable for someone to do

void F(C &&o) {

to let a sequence of functions examine an object
and maybe take it, maybe not.  First one that
wants it, gets it, the rest see a moved-from
empty object.

On Thu, Jun 22, 2023 at 11:39 AM Thiago Macieira via Std-Proposals <> wrote:
On Thursday, 22 June 2023 06:30:05 PDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> Make it compulsory for a compiler to issue a diagnostic (and possibly
> also terminate compilation) in the following scenario:
>     void Func(SomeClass &&obj)
>     {
>         SomeOtherFunc( move(obj) );
>         AndAgainSomeOtherFunction( move(obj) );
>     }

clang-tidy already issues this warning. I see no reason why a compiler
couldn't do it too. This means it's QoI, so please open a request with your
vendor for them to do it.

The code above is NOT ill-formed and there's nothing the standard can do to
enforce. The classes in question could abuse rvalue mechanisms to store an
output value in "obj" which can be passed from object to object.

Thiago Macieira - thiago (AT) - thiago (AT)
   Software Architect - Intel DCAI Cloud Engineering

Std-Proposals mailing list