From a5ebfd3e2ad8b429165afb90ffe0a91fe790ff2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Sat, 20 Dec 2014 19:16:03 +0000 Subject: [PATCH] vector (std::__debug::vector<>::clear()): Do not reset guaranteed capacity. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2014-12-20 François Dumont * include/debug/vector (std::__debug::vector<>::clear()): Do not reset guaranteed capacity. * testsuite/23_containers/vector/bool/allocator/swap.cc: Move propagating_allocator equality and inequality operators to __gnu_test namespace. From-SVN: r218991 --- libstdc++-v3/ChangeLog | 6 +++ libstdc++-v3/include/debug/vector | 1 - .../vector/bool/allocator/swap.cc | 37 ++++++++++--------- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f07255f5593..60c90f753a9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2014-12-20 François Dumont + * include/debug/vector (std::__debug::vector<>::clear()): Do not reset + guaranteed capacity. + * testsuite/23_containers/vector/bool/allocator/swap.cc: Move + propagating_allocator equality and inequality operators to __gnu_test + namespace. + * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error. * include/bits/c++config: inline __cxx11 namespace within namespace diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index f92a77fed11..174dd7a99fc 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -669,7 +669,6 @@ namespace __debug { _Base::clear(); this->_M_invalidate_all(); - this->_M_guaranteed_capacity = 0; } _Base& diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc index cedb24f5ab2..334b955decf 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc @@ -23,25 +23,28 @@ using T = bool; +namespace __gnu_test +{ + // It is undefined behaviour to swap() containers with unequal allocators + // if the allocator doesn't propagate, so ensure the allocators compare + // equal, while still being able to test propagation via get_personality(). + bool + operator==(const propagating_allocator&, + const propagating_allocator&) + { + return true; + } + + bool + operator!=(const propagating_allocator&, + const propagating_allocator&) + { + return false; + } +} + using __gnu_test::propagating_allocator; -// It is undefined behaviour to swap() containers wth unequal allocators -// if the allocator doesn't propagate, so ensure the allocators compare -// equal, while still being able to test propagation via get_personality(). -bool -operator==(const propagating_allocator&, - const propagating_allocator&) -{ - return true; -} - -bool -operator!=(const propagating_allocator&, - const propagating_allocator&) -{ - return false; -} - void test01() { bool test __attribute__((unused)) = true;