Fix vector C++11 allocator bug

François Dumont frs.dumont@gmail.com
Fri Mar 8 20:17:00 GMT 2013


On 03/07/2013 11:46 PM, Jonathan Wakely wrote:
> As expected it works for vector/swap.cc too. So we definitely need the 
> bug fix to std::vector::operator= and the testsuite changes to add 
> elements, but I think I'd prefer to just re-swap the containers in the 
> non-propagating case. 

This is indeed better so I applied the patch as you proposed.

2013-03-08  François Dumont  <fdumont@gcc.gnu.org>

     * include/bits/vector.tcc (vector<>operator=(const vector<>&):
     Reset pointers after deallocation when memory can be reused.
     * testsuite/23_containers/vector/allocator/minimal.cc: Insert
     elements to really challenge C++11 allocator integration.
     * testsuite/23_containers/vector/allocator/copy.cc: Likewise.
     * testsuite/23_containers/vector/allocator/copy_assign.cc:
     Likewise.
     * testsuite/23_containers/vector/allocator/move_assign.cc:
     Likewise.
     * testsuite/23_containers/vector/allocator/swap.cc: Likewise and
     swap vector back before checks on memory/personality mapping are
     performed.
     * testsuite/23_containers/forward_list/allocator/minimal.cc:
     Insert element to really challenge C++11 allocator integration.
     * testsuite/23_containers/forward_list/allocator/copy.cc:
     Likewise.
     * testsuite/23_containers/forward_list/allocator/copy_assign.cc:
     Likewise.
     * testsuite/23_containers/forward_list/allocator/move_assign.cc:
     Likewise.
     * testsuite/23_containers/forward_list/allocator/swap.cc: Likewise
     and swap forward_list back before checks on memory/personality
     mapping are performed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc.patch
Type: text/x-patch
Size: 9306 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130308/cb004177/attachment.bin>


More information about the Libstdc++ mailing list