[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 Jonathan Wakely changed: What|Removed |Added CC||arthur.j.odwyer at gmail dot com --- Comment #6 from Jonathan Wakely --- *** Bug 89610 has been marked as a duplicate of this bug. ***
[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 --- Comment #5 from François Dumont --- Author: fdumont Date: Thu Jan 9 05:40:08 2020 New Revision: 280028 URL: https://gcc.gnu.org/viewcvs?rev=280028=gcc=rev Log: PR libstdc++/92124 fix incorrect unordered container move assignment * include/bits/hashtable.h (_Hashtable<>::__alloc_node_gen_t): New template alias. (_Hashtable<>::__fwd_value_for): New. (_Hashtable<>::_M_assign_elements<>): Remove _NodeGenerator template parameter. (_Hashtable<>::_M_assign<>): Add _Ht template parameter. (_Hashtable<>::operator=(const _Hashtable<>&)): Adapt. (_Hashtable<>::_M_move_assign): Adapt. Replace std::move_if_noexcept with std::move. (_Hashtable<>::_Hashtable(const _Hashtable&)): Adapt. (_Hashtable<>::_Hashtable(const _Hashtable&, const allocator_type&)): Adapt. (_Hashtable<>::_Hashtable(_Hashtable&&, const allocator_type&)): Adapt. * testsuite/23_containers/unordered_set/92124.cc: New. Added: trunk/libstdc++-v3/testsuite/23_containers/unordered_set/92124.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/hashtable.h
[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 --- Comment #4 from François Dumont --- Author: fdumont Date: Tue Jan 7 21:01:37 2020 New Revision: 279967 URL: https://gcc.gnu.org/viewcvs?rev=279967=gcc=rev Log: PR libstdc++/92124 fix incorrect container move assignment * include/bits/stl_tree.h (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Replace std::move_if_noexcept by std::move. * testsuite/23_containers/map/92124.cc: New. * testsuite/23_containers/set/92124.cc: New. Added: trunk/libstdc++-v3/testsuite/23_containers/map/92124.cc trunk/libstdc++-v3/testsuite/23_containers/set/92124.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_tree.h
[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 --- Comment #3 from Jonathan Wakely --- Author: redi Date: Thu Oct 17 14:21:27 2019 New Revision: 277113 URL: https://gcc.gnu.org/viewcvs?rev=277113=gcc=rev Log: PR libstdc++/92124 fix incorrect container move assignment The container requirements say that for move assignment "All existing elements of [the target] are either move assigned or destroyed". Some of our containers currently use __make_move_if_noexcept which makes the move depend on whether the element type is nothrow move constructible. This is incorrect, because the standard says we must move assign, not move or copy depending on the move constructor. Use make_move_iterator instead so that we move unconditionally. This ensures existing elements won't be copy assigned. PR libstdc++/92124 * include/bits/forward_list.h (_M_move_assign(forward_list&&, false_type)): Do not use __make_move_if_noexcept, instead move unconditionally. * include/bits/stl_deque.h (_M_move_assign2(deque&&, false_type)): Likewise. * include/bits/stl_list.h (_M_move_assign(list&&, false_type)): Likewise. * include/bits/stl_vector.h (_M_move_assign(vector&&, false_type)): Likewise. * testsuite/23_containers/vector/92124.cc: New test. Added: trunk/libstdc++-v3/testsuite/23_containers/deque/92124.cc trunk/libstdc++-v3/testsuite/23_containers/forward_list/92124.cc trunk/libstdc++-v3/testsuite/23_containers/list/92124.cc trunk/libstdc++-v3/testsuite/23_containers/vector/92124.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/forward_list.h trunk/libstdc++-v3/include/bits/stl_deque.h trunk/libstdc++-v3/include/bits/stl_list.h trunk/libstdc++-v3/include/bits/stl_vector.h
[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |10.0 --- Comment #2 from Jonathan Wakely --- Fixed on trunk.
[Bug libstdc++/92124] std::vector copy-assigning when it should move-assign.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92124 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-10-16 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- I'm testing a patch now.