[Bug libstdc++/108118] std::weak_ptr lacks a self-usurp check on move

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 15 09:33:17 GMT 2022


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Basically you have:
> w = std::move(w);
> 
> I think that is just undefined code at this point ... But I am not 100% sure.

Nope, it's allowed. But it's not required to be a no-op.

(In reply to Andrew Pinski from comment #3)
> Unless https://cplusplus.github.io/LWG/issue2315 is not implemented ...

That was done years ago: r5-4842-gf871d7f9f458d8


More information about the Gcc-bugs mailing list