Index: libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp @@ -66,11 +66,24 @@ #endif } +// Test with a number of elements in the source range +// that is greater than capacity +void test_assign_bigger() { + typedef forward_iterator It; + std::vector dst(10); + + size_t n = dst.capacity() * 2; + std::vector src(n); + + dst.assign(It(src.data()), It(src.data() + src.size())); + assert(dst == src); +} int main(int, char**) { test_emplaceable_concept(); + test_assign_bigger(); return 0; } Index: libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp @@ -39,7 +39,12 @@ test(d1); test(d2); } - + { + std::vector vec; + vec.reserve(32); + vec.resize(16); // destruction during assign + test(vec); + } #if TEST_STD_VER >= 11 { typedef std::vector> V; Index: libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp @@ -26,13 +26,22 @@ template void test(Iterator first, Iterator last) { - C c(first, last); - LIBCPP_ASSERT(c.__invariants()); - assert(c.size() == static_cast(std::distance(first, last))); - LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); - for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; - ++i, ++first) + { + C c(first, last); + LIBCPP_ASSERT(c.__invariants()); + assert(c.size() == static_cast(std::distance(first, last))); + LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); + for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; + ++i, ++first) assert(*i == *first); + } + // Test with an empty range + { + C c(first, first); + LIBCPP_ASSERT(c.__invariants()); + assert(c.empty()); + LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); + } } static void basic_test_cases() { Index: libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp @@ -62,12 +62,17 @@ int main(int, char**) { + test >(0); test >(50); + test >(0); test >(500); assert(DefaultOnly::count == 0); #if TEST_STD_VER >= 11 + test> >(0); test> >(50); + test> >(0); test> >(500); + test2> >( 0, test_allocator(23)); test2> >( 100, test_allocator(23)); assert(DefaultOnly::count == 0); #endif Index: libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp @@ -32,10 +32,14 @@ int main(int, char**) { + test >(0, 3); test >(50, 3); // Add 1 for implementations that dynamically allocate a container proxy. + test > >(0, 5); + test > >(50, 5); test > >(50, 5); #if TEST_STD_VER >= 11 + test> >(0, 3); test> >(50, 3); #endif Index: libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp @@ -33,8 +33,10 @@ int main(int, char**) { + test >(0, 3, std::allocator()); test >(50, 3, std::allocator()); #if TEST_STD_VER >= 11 + test> >(0, 3, min_allocator()); test> >(50, 3, min_allocator()); #endif Index: libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp @@ -47,6 +47,18 @@ assert(is_contiguous_container_asan_correct(v)); assert(is_contiguous_container_asan_correct(v2)); } + { + // Test copy ctor with empty source + std::vector > v(test_allocator(5)); + std::vector > v2 = v; + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); + assert(v2 == v); + assert(v2.get_allocator() == v.get_allocator()); + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); + assert(v2.empty()); + } #if TEST_STD_VER >= 11 { std::vector > v(3, 2, other_allocator(5)); Index: libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp @@ -49,6 +49,14 @@ assert(l2 == l); assert(l2.get_allocator() == other_allocator(3)); } + { + // Test copy ctor with allocator and empty source + std::vector > l(other_allocator(5)); + std::vector > l2(l, other_allocator(3)); + assert(l2 == l); + assert(l2.get_allocator() == other_allocator(3)); + assert(l2.empty()); + } #if TEST_STD_VER >= 11 { int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; Index: libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp @@ -42,6 +42,12 @@ assert(d[2] == 5); assert(d[3] == 6); } + { + std::vector> d({}, min_allocator()); + assert(d.size() == 0); + assert(d.empty()); + assert(is_contiguous_container_asan_correct(d)); + } return 0; }