diff --git a/libcxx/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// list(list&& c); - -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcxx-no-debug-mode - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(1)) - -#include -#include -#include -#include "test_macros.h" -#include "MoveOnly.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main(int, char**) -{ - std::list l1 = {1, 2, 3}; - std::list::iterator i = l1.begin(); - std::list l2 = std::move(l1); - assert(*l2.erase(i) == 2); - - return 0; -} diff --git a/libcxx/test/libcxx/containers/unord/unord.map/db_move.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/db_move.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/containers/unord/unord.map/db_move.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// unordered_map(unordered_map&& u); - -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcxx-no-debug-mode - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) { - std::unordered_map s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_map::iterator i = s1.begin(); - std::pair k = *i; - std::unordered_map s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - - return 0; -} diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/db_move.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/db_move.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multimap/db_move.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// - -// unordered_multimap(unordered_multimap&& u); - -// UNSUPPORTED: libcxx-no-debug-mode - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) { - std::unordered_multimap s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_multimap::iterator i = s1.begin(); - std::pair k = *i; - std::unordered_multimap s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - - return 0; -} diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/db_move.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/db_move.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/containers/unord/unord.multiset/db_move.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 - -// - -// unordered_multiset(unordered_multiset&& u); - -// UNSUPPORTED: libcxx-no-debug-mode - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) { - std::unordered_multiset s1 = {1, 2, 3}; - std::unordered_multiset::iterator i = s1.begin(); - int k = *i; - std::unordered_multiset s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - - return 0; -} diff --git a/libcxx/test/libcxx/containers/unord/unord.set/db_move.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/db_move.pass.cpp deleted file mode 100644 --- a/libcxx/test/libcxx/containers/unord/unord.set/db_move.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03 -// UNSUPPORTED: libcxx-no-debug-mode - -// - -// unordered_set(unordered_set&& u); - -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) { - std::unordered_set s1 = {1, 2, 3}; - std::unordered_set::iterator i = s1.begin(); - int k = *i; - std::unordered_set s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - - return 0; -} diff --git a/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp --- a/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp @@ -30,10 +30,12 @@ lo.push_back(i); } std::list > l2(test_allocator(5)); + std::list >::iterator it = l.begin(); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } { std::list > l(test_allocator(5)); @@ -58,10 +60,12 @@ lo.push_back(i); } std::list > l2(other_allocator(6)); + std::list >::iterator it = l.begin(); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } { std::list > l(min_allocator{}); @@ -72,10 +76,12 @@ lo.push_back(i); } std::list > l2(min_allocator{}); + std::list >::iterator it = l.begin(); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } return 0; diff --git a/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp --- a/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp @@ -29,10 +29,12 @@ l.push_back(i); lo.push_back(i); } + std::list >::iterator it = l.begin(); std::list > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } { std::list > l(other_allocator(5)); @@ -42,10 +44,12 @@ l.push_back(i); lo.push_back(i); } + std::list >::iterator it = l.begin(); std::list > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } { std::list > l(min_allocator{}); @@ -55,10 +59,12 @@ l.push_back(i); lo.push_back(i); } + std::list >::iterator it = l.begin(); std::list > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(it == l2.begin()); // Iterators remain valid } return 0; diff --git a/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp --- a/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp @@ -22,37 +22,37 @@ { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0])); - std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + std::list c1(a1, a1 + 5); + std::list c2(a2, a2 + 7); + std::list::iterator it1 = c1.begin(); + std::list::const_iterator it2 = c2.begin(); swap(c1, c2); - assert(c1 == std::list(a2, a2+sizeof(a2)/sizeof(a2[0]))); - assert(c2 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0]))); + assert(c1 == std::list(a2, a2 + 7)); + assert(c2 == std::list(a1, a1 + 5)); + assert(it1 == c2.begin()); // Iterators remain valid + assert(it2 == c1.begin()); // Iterators remain valid } { - int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list c1(a1, a1); - std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + std::list c1; + std::list c2(a2, a2 + 7); swap(c1, c2); - assert(c1 == std::list(a2, a2+sizeof(a2)/sizeof(a2[0]))); + assert(c1 == std::list(a2, a2 + 7)); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); } { int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0])); - std::list c2(a2, a2); + std::list c1(a1, a1 + 5); + std::list c2; swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); - assert(c2 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0]))); + assert(c2 == std::list(a1, a1 + 5)); } { - int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list c1(a1, a1); - std::list c2(a2, a2); + std::list c1; + std::list c2; swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); @@ -63,61 +63,57 @@ int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; typedef test_allocator A; - std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1)); - std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1)); + std::list c1(a1, a1 + 5, A(1)); + std::list c2(a2, a2 + 7, A(1)); swap(c1, c2); - assert((c1 == std::list(a2, a2+sizeof(a2)/sizeof(a2[0])))); + assert((c1 == std::list(a2, a2 + 7))); assert(c1.get_allocator() == A(1)); - assert((c2 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert((c2 == std::list(a1, a1 + 5))); assert(c2.get_allocator() == A(1)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; typedef other_allocator A; - std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1)); - std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2)); + std::list c1(a1, a1 + 5, A(1)); + std::list c2(a2, a2 + 7, A(2)); swap(c1, c2); - assert((c1 == std::list(a2, a2+sizeof(a2)/sizeof(a2[0])))); + assert((c1 == std::list(a2, a2 + 7))); assert(c1.get_allocator() == A(2)); - assert((c2 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert((c2 == std::list(a1, a1 + 5))); assert(c2.get_allocator() == A(1)); } #if TEST_STD_VER >= 11 { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); - std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + std::list> c1(a1, a1 + 5); + std::list> c2(a2, a2 + 7); swap(c1, c2); - assert((c1 == std::list>(a2, a2+sizeof(a2)/sizeof(a2[0])))); - assert((c2 == std::list>(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert((c1 == std::list>(a2, a2 + 7))); + assert((c2 == std::list>(a1, a1 + 5))); } { - int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list> c1(a1, a1); - std::list> c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + std::list> c1; + std::list> c2(a2, a2 + 7); swap(c1, c2); - assert((c1 == std::list>(a2, a2+sizeof(a2)/sizeof(a2[0])))); + assert((c1 == std::list>(a2, a2 + 7))); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); } { int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); - std::list> c2(a2, a2); + std::list> c1(a1, a1 + 5); + std::list> c2; swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); - assert((c2 == std::list>(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert((c2 == std::list>(a1, a1 + 5))); } { - int a1[] = {1, 3, 7, 9, 10}; - int a2[] = {0, 2, 4, 5, 6, 8, 11}; - std::list> c1(a1, a1); - std::list> c2(a2, a2); + std::list> c1; + std::list> c2; swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); @@ -128,15 +124,15 @@ int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; typedef min_allocator A; - std::list c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A()); - std::list c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A()); + std::list c1(a1, a1 + 5, A()); + std::list c2(a2, a2 + 7, A()); swap(c1, c2); - assert((c1 == std::list(a2, a2+sizeof(a2)/sizeof(a2[0])))); + assert((c1 == std::list(a2, a2 + 7))); assert(c1.get_allocator() == A()); - assert((c2 == std::list(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert((c2 == std::list(a1, a1 + 5))); assert(c2.get_allocator() == A()); } #endif - return 0; + return 0; } diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp @@ -105,6 +105,7 @@ test_compare >(3), A(10) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -121,6 +122,7 @@ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c0.size() == 0); + assert(it0 == c.begin()); // Iterators remain valid } { typedef other_allocator > A; @@ -151,6 +153,7 @@ test_compare >(3), A(4) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -167,6 +170,7 @@ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c0.size() == 0); + assert(it0 == c.begin()); // Iterators remain valid } { typedef min_allocator > A; @@ -197,6 +201,7 @@ test_compare >(3), A() ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -213,6 +218,7 @@ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c0.size() == 0); + assert(it0 == c.begin()); // Iterators remain valid } return 0; diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp @@ -42,6 +42,7 @@ test_compare >(9), test_allocator >(10) ); + C::iterator it0 = c0.begin(); C c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 0); @@ -54,6 +55,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(c.load_factor() == 0); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid assert(c0.empty()); } @@ -79,6 +81,7 @@ test_compare >(9), test_allocator >(10) ); + C::iterator it0 = c0.begin(); C c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -95,6 +98,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid assert(c0.empty()); } @@ -109,6 +113,7 @@ test_compare >(9), min_allocator >() ); + C::iterator it0 = c0.begin(); C c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 0); @@ -121,6 +126,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(c.load_factor() == 0); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid assert(c0.empty()); } @@ -146,6 +152,7 @@ test_compare >(9), min_allocator >() ); + C::iterator it0 = c0.begin(); C c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -162,6 +169,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid assert(c0.empty()); } diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp --- a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp @@ -75,6 +75,7 @@ C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -93,6 +94,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); @@ -121,6 +123,7 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); @@ -144,6 +147,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { typedef test_hash > Hash; @@ -174,6 +178,8 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -192,6 +198,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated assert(c2.bucket_count() >= 4); assert(c2.size() == 4); @@ -205,6 +212,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp @@ -122,7 +122,9 @@ test_compare >(3), A(10) ); + C::iterator it0 = c0.begin(); c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); typedef std::pair Eq; @@ -182,7 +184,9 @@ test_compare >(3), A(4) ); + C::iterator it0 = c0.begin(); c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); typedef std::pair Eq; @@ -242,7 +246,9 @@ test_compare >(3), A() ); + C::iterator it0 = c0.begin(); c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); typedef std::pair Eq; diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp @@ -82,7 +82,9 @@ test_compare >(9), test_allocator >(10) ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); typedef std::pair Eq; @@ -166,7 +168,9 @@ test_compare >(9), min_allocator >() ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); typedef std::pair Eq; diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp @@ -77,6 +77,7 @@ C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -95,6 +96,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); @@ -123,6 +125,7 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); @@ -151,6 +154,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { typedef test_hash > Hash; @@ -181,6 +185,8 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -199,6 +205,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated assert(c2.bucket_count() >= 6); assert(c2.size() == 6); @@ -217,6 +224,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp @@ -105,6 +105,7 @@ test_compare >(3), A(10) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); @@ -120,6 +121,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } { typedef other_allocator A; @@ -150,6 +152,7 @@ test_compare >(3), A(4) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); @@ -165,6 +168,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } { typedef test_allocator A; @@ -195,6 +199,7 @@ test_compare >(3), A() ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); @@ -210,6 +215,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } { typedef min_allocator A; @@ -240,6 +246,7 @@ test_compare >(3), A() ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); @@ -255,6 +262,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } return 0; diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp @@ -77,7 +77,9 @@ test_compare >(9), test_allocator(10) ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); assert(c.count(1) == 2); @@ -142,7 +144,9 @@ test_compare >(9), min_allocator() ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); assert(c.count(1) == 2); diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp @@ -74,6 +74,7 @@ C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -92,6 +93,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); @@ -120,6 +122,7 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); @@ -143,6 +146,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { typedef test_hash > Hash; @@ -173,6 +177,8 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -191,6 +197,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated assert(c2.bucket_count() >= 6); assert(c2.size() == 6); @@ -204,6 +211,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp @@ -104,6 +104,7 @@ test_compare >(3), A(10) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -119,6 +120,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } { typedef other_allocator A; @@ -149,6 +151,7 @@ test_compare >(3), A(4) ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -164,6 +167,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } { typedef min_allocator A; @@ -194,6 +198,7 @@ test_compare >(3), A() ); + C::iterator it0 = c0.begin(); c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); @@ -209,6 +214,7 @@ assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); + assert(it0 == c.begin()); // Iterators remain valid } return 0; diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp --- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp @@ -77,7 +77,9 @@ test_compare >(9), test_allocator(10) ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); assert(c.count(1) == 1); @@ -142,7 +144,9 @@ test_compare >(9), min_allocator() ); + C::iterator it0 = c0.begin(); C c = std::move(c0); + assert(it0 == c.begin()); // Iterators remain valid LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 4); assert(c.count(1) == 1); diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp --- a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp @@ -74,6 +74,7 @@ C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -92,6 +93,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated LIBCPP_ASSERT(c2.bucket_count() == 0); assert(c2.size() == 0); @@ -120,6 +122,7 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); swap(c1, c2); LIBCPP_ASSERT(c1.bucket_count() == 0); @@ -143,6 +146,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } { typedef test_hash > Hash; @@ -173,6 +177,8 @@ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1)); C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); + C::iterator it1 = c1.begin(); + C::iterator it2 = c2.begin(); swap(c1, c2); assert(c1.bucket_count() >= 8); @@ -191,6 +197,7 @@ assert(static_cast(std::distance(c1.begin(), c1.end())) == c1.size()); assert(static_cast(std::distance(c1.cbegin(), c1.cend())) == c1.size()); assert(c1.max_load_factor() == 2); + assert(it2 == c1.begin()); // Iterators are not invalidated assert(c2.bucket_count() >= 4); assert(c2.size() == 4); @@ -204,6 +211,7 @@ assert(static_cast(std::distance(c2.begin(), c2.end())) == c2.size()); assert(static_cast(std::distance(c2.cbegin(), c2.cend())) == c2.size()); assert(c2.max_load_factor() == 1); + assert(it1 == c2.begin()); // Iterators are not invalidated } {