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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Askar Safin from comment #5)
> 4. But (as it seems for me) the standard nowhere says that std::swap (a, a)
> is unspecified. So, it should be specified

It's specified to do:

  T tmp = std::move(a);
  a = std::move(a);
  a = std::move(tmp);

Before DR2468 this whole thing had undefined behaviour, due to the "a =
std::move(a)" statement. Now that statement leaves 'a' in an unspecified state,
but then the next statement puts it back into a specified state. So there's no
undefined behaviour.

In your original comment you said "But there are other variants, of course. For
example, remove rvalue ref uniqueness assumption from the standard." And that's
what happened.

I still don't see any change needed to std::swap.

Reply via email to