STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
[libcxx] [test] Swapping non-equal non-POCS allocators is UB. test_allocator is a non-POCS allocator. Instead of swapping containers with A(1) and A(2), which triggers undefined behavior, swapping A(3) with A(3) is conformant. test/std/containers/sequences/vector/vector.special/swap.pass.cpp Remove "#ifndef _LIBCPP_DEBUG_LEVEL" and a comment about the now-fixed undefined behavior. https://reviews.llvm.org/D26623 Files: test/std/containers/associative/map/map.special/non_member_swap.pass.cpp test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp test/std/containers/associative/set/set.special/non_member_swap.pass.cpp test/std/containers/sequences/deque/deque.special/swap.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp test/std/containers/sequences/vector.bool/swap.pass.cpp test/std/containers/sequences/vector/vector.special/swap.pass.cpp test/std/containers/unord/unord.map/swap_member.pass.cpp test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multimap/swap_member.pass.cpp test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.multiset/swap_member.pass.cpp test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp test/std/containers/unord/unord.set/swap_member.pass.cpp test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
Index: test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_allocator<int> Alloc; typedef std::unordered_set<int, Hash, Compare, Alloc> C; typedef int P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70), P(80) }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -89,16 +89,16 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1), P(2) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70), P(80) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -188,7 +188,7 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.set/swap_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/swap_member.pass.cpp +++ test/std/containers/unord/unord.set/swap_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_allocator<int> Alloc; typedef std::unordered_set<int, Hash, Compare, Alloc> C; typedef int P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70), P(80) }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -89,16 +89,16 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1), P(2) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70), P(80) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -188,7 +188,7 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_allocator<int> Alloc; typedef std::unordered_multiset<int, Hash, Compare, Alloc> C; typedef int P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70), P(80) }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -89,16 +89,16 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1), P(2) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70), P(80) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -188,7 +188,7 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.multiset/swap_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/swap_member.pass.cpp +++ test/std/containers/unord/unord.multiset/swap_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_allocator<int> Alloc; typedef std::unordered_multiset<int, Hash, Compare, Alloc> C; typedef int P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70), P(80) }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -89,16 +89,16 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1), P(2) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70), P(80) }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -188,7 +188,7 @@ assert(*c1.find(80) == 80); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.count(4) == 1); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp @@ -33,25 +33,25 @@ typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C; typedef std::pair<int, std::string> P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -73,8 +73,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -90,16 +90,16 @@ assert(c1.find(80)->second == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -119,16 +119,16 @@ P(1, "four"), P(2, "four"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -143,7 +143,7 @@ assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -174,8 +174,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -191,7 +191,7 @@ assert(c1.find(80)->second == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -206,7 +206,7 @@ assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.multimap/swap_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/swap_member.pass.cpp +++ test/std/containers/unord/unord.multimap/swap_member.pass.cpp @@ -34,25 +34,25 @@ typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C; typedef std::pair<int, std::string> P; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -74,8 +74,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -91,16 +91,16 @@ assert(c1.find(80)->second == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -120,16 +120,16 @@ P(1, "four"), P(2, "four"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -144,7 +144,7 @@ assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -175,8 +175,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -192,7 +192,7 @@ assert(c1.find(80)->second == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -207,7 +207,7 @@ assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_compare<std::equal_to<int> > Compare; typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -89,16 +89,16 @@ assert(c1.at(80) == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1, "four"), P(2, "four"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.at(4) == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); swap(c1, c2); @@ -188,7 +188,7 @@ assert(c1.at(80) == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.at(4) == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/unord/unord.map/swap_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/swap_member.pass.cpp +++ test/std/containers/unord/unord.map/swap_member.pass.cpp @@ -32,25 +32,25 @@ typedef test_compare<std::equal_to<int> > Compare; typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -72,8 +72,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -89,16 +89,16 @@ assert(c1.at(80) == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -118,16 +118,16 @@ P(1, "four"), P(2, "four"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); LIBCPP_ASSERT(c1.bucket_count() == 0); assert(c1.size() == 0); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -140,7 +140,7 @@ assert(c2.at(4) == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); @@ -171,8 +171,8 @@ P(70, "seventy"), P(80, "eighty"), }; - C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1)); - C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2)); + C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(3)); + C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(3)); c2.max_load_factor(2); c1.swap(c2); @@ -188,7 +188,7 @@ assert(c1.at(80) == "eighty"); assert(c1.hash_function() == Hash(2)); assert(c1.key_eq() == Compare(2)); - assert(c1.get_allocator() == Alloc(1)); + assert(c1.get_allocator() == Alloc(3)); assert(std::distance(c1.begin(), c1.end()) == c1.size()); assert(std::distance(c1.cbegin(), c1.cend()) == c1.size()); assert(c1.max_load_factor() == 2); @@ -201,7 +201,7 @@ assert(c2.at(4) == "four"); assert(c2.hash_function() == Hash(1)); assert(c2.key_eq() == Compare(1)); - assert(c2.get_allocator() == Alloc(2)); + assert(c2.get_allocator() == Alloc(3)); assert(std::distance(c2.begin(), c2.end()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(c2.max_load_factor() == 1); Index: test/std/containers/sequences/vector/vector.special/swap.pass.cpp =================================================================== --- test/std/containers/sequences/vector/vector.special/swap.pass.cpp +++ test/std/containers/sequences/vector/vector.special/swap.pass.cpp @@ -77,21 +77,18 @@ assert(is_contiguous_container_asan_correct(c1)); assert(is_contiguous_container_asan_correct(c2)); } -#ifndef _LIBCPP_DEBUG_LEVEL -// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1 { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; typedef test_allocator<int> A; - std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1)); - std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2)); + std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(3)); + std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(3)); swap(c1, c2); assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0])))); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0])))); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } -#endif { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; Index: test/std/containers/sequences/vector.bool/swap.pass.cpp =================================================================== --- test/std/containers/sequences/vector.bool/swap.pass.cpp +++ test/std/containers/sequences/vector.bool/swap.pass.cpp @@ -30,15 +30,15 @@ } { typedef test_allocator<bool> A; - std::vector<bool, A> v1(100, true, A(1)); - std::vector<bool, A> v2(200, false, A(2)); + std::vector<bool, A> v1(100, true, A(3)); + std::vector<bool, A> v2(200, false, A(3)); swap(v1, v2); assert(v1.size() == 200); assert(v1.capacity() >= 200); assert(v2.size() == 100); assert(v2.capacity() >= 100); - assert(v1.get_allocator() == A(1)); - assert(v2.get_allocator() == A(2)); + assert(v1.get_allocator() == A(3)); + assert(v2.get_allocator() == A(3)); } { typedef other_allocator<bool> A; Index: test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp =================================================================== --- test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp +++ test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp @@ -25,78 +25,78 @@ typedef test_allocator<T> A; typedef std::forward_list<T, A> C; const T t1[] = {0, 1, 2, 3, 4, 5}; - C c1(std::begin(t1), std::end(t1), A(1)); + C c1(std::begin(t1), std::end(t1), A(3)); const T t2[] = {10, 11, 12}; - C c2(std::begin(t2), std::end(t2), A(2)); + C c2(std::begin(t2), std::end(t2), A(3)); swap(c1, c2); assert(distance(c1.begin(), c1.end()) == 3); assert(*next(c1.begin(), 0) == 10); assert(*next(c1.begin(), 1) == 11); assert(*next(c1.begin(), 2) == 12); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 6); assert(*next(c2.begin(), 0) == 0); assert(*next(c2.begin(), 1) == 1); assert(*next(c2.begin(), 2) == 2); assert(*next(c2.begin(), 3) == 3); assert(*next(c2.begin(), 4) == 4); assert(*next(c2.begin(), 5) == 5); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; const T t1[] = {0, 1, 2, 3, 4, 5}; - C c1(std::begin(t1), std::end(t1), A(1)); - C c2(A(2)); + C c1(std::begin(t1), std::end(t1), A(3)); + C c2(A(3)); swap(c1, c2); assert(distance(c1.begin(), c1.end()) == 0); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 6); assert(*next(c2.begin(), 0) == 0); assert(*next(c2.begin(), 1) == 1); assert(*next(c2.begin(), 2) == 2); assert(*next(c2.begin(), 3) == 3); assert(*next(c2.begin(), 4) == 4); assert(*next(c2.begin(), 5) == 5); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; - C c1(A(1)); + C c1(A(3)); const T t2[] = {10, 11, 12}; - C c2(std::begin(t2), std::end(t2), A(2)); + C c2(std::begin(t2), std::end(t2), A(3)); swap(c1, c2); assert(distance(c1.begin(), c1.end()) == 3); assert(*next(c1.begin(), 0) == 10); assert(*next(c1.begin(), 1) == 11); assert(*next(c1.begin(), 2) == 12); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 0); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; - C c1(A(1)); - C c2(A(2)); + C c1(A(3)); + C c2(A(3)); swap(c1, c2); assert(distance(c1.begin(), c1.end()) == 0); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 0); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { Index: test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp =================================================================== --- test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp +++ test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp @@ -24,78 +24,78 @@ typedef test_allocator<T> A; typedef std::forward_list<T, A> C; const T t1[] = {0, 1, 2, 3, 4, 5}; - C c1(std::begin(t1), std::end(t1), A(1)); + C c1(std::begin(t1), std::end(t1), A(3)); const T t2[] = {10, 11, 12}; - C c2(std::begin(t2), std::end(t2), A(2)); + C c2(std::begin(t2), std::end(t2), A(3)); c1.swap(c2); assert(distance(c1.begin(), c1.end()) == 3); assert(*next(c1.begin(), 0) == 10); assert(*next(c1.begin(), 1) == 11); assert(*next(c1.begin(), 2) == 12); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 6); assert(*next(c2.begin(), 0) == 0); assert(*next(c2.begin(), 1) == 1); assert(*next(c2.begin(), 2) == 2); assert(*next(c2.begin(), 3) == 3); assert(*next(c2.begin(), 4) == 4); assert(*next(c2.begin(), 5) == 5); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; const T t1[] = {0, 1, 2, 3, 4, 5}; - C c1(std::begin(t1), std::end(t1), A(1)); - C c2(A(2)); + C c1(std::begin(t1), std::end(t1), A(3)); + C c2(A(3)); c1.swap(c2); assert(distance(c1.begin(), c1.end()) == 0); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 6); assert(*next(c2.begin(), 0) == 0); assert(*next(c2.begin(), 1) == 1); assert(*next(c2.begin(), 2) == 2); assert(*next(c2.begin(), 3) == 3); assert(*next(c2.begin(), 4) == 4); assert(*next(c2.begin(), 5) == 5); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; - C c1(A(1)); + C c1(A(3)); const T t2[] = {10, 11, 12}; - C c2(std::begin(t2), std::end(t2), A(2)); + C c2(std::begin(t2), std::end(t2), A(3)); c1.swap(c2); assert(distance(c1.begin(), c1.end()) == 3); assert(*next(c1.begin(), 0) == 10); assert(*next(c1.begin(), 1) == 11); assert(*next(c1.begin(), 2) == 12); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 0); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { typedef int T; typedef test_allocator<T> A; typedef std::forward_list<T, A> C; - C c1(A(1)); - C c2(A(2)); + C c1(A(3)); + C c2(A(3)); c1.swap(c2); assert(distance(c1.begin(), c1.end()) == 0); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert(distance(c2.begin(), c2.end()) == 0); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { Index: test/std/containers/sequences/deque/deque.special/swap.pass.cpp =================================================================== --- test/std/containers/sequences/deque/deque.special/swap.pass.cpp +++ test/std/containers/sequences/deque/deque.special/swap.pass.cpp @@ -65,13 +65,13 @@ int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; typedef test_allocator<int> A; - std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1)); - std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2)); + std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(3)); + std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(3)); swap(c1, c2); assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0])))); - assert(c1.get_allocator() == A(1)); + assert(c1.get_allocator() == A(3)); assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0])))); - assert(c2.get_allocator() == A(2)); + assert(c2.get_allocator() == A(3)); } { int a1[] = {1, 3, 7, 9, 10}; Index: test/std/containers/associative/set/set.special/non_member_swap.pass.cpp =================================================================== --- test/std/containers/associative/set/set.special/non_member_swap.pass.cpp +++ test/std/containers/associative/set/set.special/non_member_swap.pass.cpp @@ -118,17 +118,17 @@ 11, 12 }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); + M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(3)); + M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(3)); M m1_save = m1; M m2_save = m2; swap(m1, m2); assert(m1 == m2_save); assert(m2 == m1_save); assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(1)); + assert(m1.get_allocator() == A(3)); assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(2)); + assert(m2.get_allocator() == A(3)); } { typedef other_allocator<V> A; Index: test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp =================================================================== --- test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp +++ test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp @@ -118,17 +118,17 @@ 11, 12 }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); + M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(3)); + M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(3)); M m1_save = m1; M m2_save = m2; swap(m1, m2); assert(m1 == m2_save); assert(m2 == m1_save); assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(1)); + assert(m1.get_allocator() == A(3)); assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(2)); + assert(m2.get_allocator() == A(3)); } { typedef other_allocator<V> A; Index: test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp =================================================================== --- test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp +++ test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp @@ -121,17 +121,17 @@ V(11, 11), V(12, 12) }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); + M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(3)); + M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(3)); M m1_save = m1; M m2_save = m2; swap(m1, m2); assert(m1 == m2_save); assert(m2 == m1_save); assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(1)); + assert(m1.get_allocator() == A(3)); assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(2)); + assert(m2.get_allocator() == A(3)); } { typedef other_allocator<V> A; Index: test/std/containers/associative/map/map.special/non_member_swap.pass.cpp =================================================================== --- test/std/containers/associative/map/map.special/non_member_swap.pass.cpp +++ test/std/containers/associative/map/map.special/non_member_swap.pass.cpp @@ -121,17 +121,17 @@ V(11, 11), V(12, 12) }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); + M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(3)); + M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(3)); M m1_save = m1; M m2_save = m2; swap(m1, m2); assert(m1 == m2_save); assert(m2 == m1_save); assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(1)); + assert(m1.get_allocator() == A(3)); assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(2)); + assert(m2.get_allocator() == A(3)); } { typedef other_allocator<V> A;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits