std::vector move assign patch

H.J. Lu hjl.tools@gmail.com
Thu Jan 9 12:22:00 GMT 2014


On Fri, Dec 27, 2013 at 10:27 AM, François Dumont <frs.dumont@gmail.com> wrote:
> Hi
>
>     Here is a patch to fix an issue in normal mode during the move
> assignment. The destination vector allocator instance is moved too during
> the assignment which is wrong.
>
>     As I discover this problem while working on issues with management of
> safe iterators during move operations this patch also fix those issues in
> the debug mode for the vector container. Fixes for other containers in debug
> mode will come later.
>
> 2013-12-27  François Dumont <fdumont@gcc.gnu.org>
>
>     * include/bits/stl_vector.h (std::vector<>::_M_move_assign): Pass
>     *this allocator instance when building temporary vector instance
>     so that *this allocator do not get moved.
>     * include/debug/safe_base.h
>     (_Safe_sequence_base(_Safe_sequence_base&&)): New.
>     * include/debug/vector (__gnu_debug::vector<>(vector&&)): Use
>     latter.
>     (__gnu_debug::vector<>(vector&&, const allocator_type&)): Swap
>     safe iterators if the instance is moved.
>     (__gnu_debug::vector<>::operator=(vector&&)): Likewise.
>     * testsuite/23_containers/vector/allocator/move.cc (test01): Add
>     check on a vector iterator.
>     * testsuite/23_containers/vector/allocator/move_assign.cc
>     (test02): Likewise.
>     (test03): New, test with a non-propagating allocator.
>     * testsuite/23_containers/vector/debug/move_assign_neg.cc: New.
>
> Tested under Linux x86_64 normal and debug modes.
>
> I will be in vacation for a week starting today so if you want to apply it
> quickly do not hesitate to do it yourself.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59738


-- 
H.J.



More information about the Libstdc++ mailing list