[Bug libstdc++/70530] [DR2468] You should probably add addressof (a) != addressof (b) check to std::swap
safinaskar at mail dot ru
gcc-bugzilla@gcc.gnu.org
Fri Jan 27 17:06:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70530
Askar Safin <safinaskar at mail dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #5 from Askar Safin <safinaskar at mail dot ru> ---
I will try to repeat.
1. DR 2468 says that after "a = std::move (a)" state of a is unspecified
2. libstdc++'s current std::swap is just 3 moves without any checks
3. From 1 and 2 current libstdc++'s std::swap (a, a) leave a in unspecified
state
4. But (as it seems for me) the standard nowhere says that std::swap (a, a) is
unspecified. So, it should be specified
5. Moreover, you just said "self-swap is not undefined", i. e. "self-swap is
defined" (I assume there is no typo here). This acknowledges 4.
So, we see clear contradiction between 3 and 4. So, something should be fixed.
Either libstdc++, either c++ standard. One solution is to fix libstdc++'s
std::swap. Other is to write to standard that std::swap (a, a) is unspecified.
There may be other solutions.
I reopen this bug
More information about the Gcc-bugs
mailing list