https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101542
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:8edb61420502c62fa2cccdd98876a9aa039b72a6 commit r12-2437-g8edb61420502c62fa2cccdd98876a9aa039b72a6 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Jul 21 15:29:19 2021 +0100 libstdc++: Make __gnu_cxx::sequence_buffer move-aware [PR101542] The PR explains that Clang trunk now selects a different constructor when a non-const sequence_buffer is returned in a context where it qualifies as an implicitly-movable entity. Because lookup is first performed using an rvalue, the sequence_buffer(const sequence_buffer&) constructor gets chosen, which makes a copy instead of a "pseudo-move" via the sequence_buffer(sequence_buffer&) constructor. The problem isn't seen with GCC because as noted in the r11-2412 commit log, GCC actually implements a slightly modified rule that avoids breaking exactly this type of code. This patch adds a move constructor to sequence_buffer, so that implicit or explicit moves will have the same effect, calling the sequence_buffer(sequence_buffer&) constructor. A move assignment operator is also added to make move assignment work similarly. Signed-off-by: Jonathan Wakely <jwak...@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101542 * include/ext/rope (sequence_buffer): Add move constructor and move assignment operator. * testsuite/ext/rope/101542.cc: New test.