diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp index 0c43c15d014e..4b9745a1c363 100644 --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp @@ -10,25 +10,30 @@ // back_insert_iterator -// explicit back_insert_iterator(Cont& x); +// explicit back_insert_iterator(Cont& x); // constexpr in C++20 #include #include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::back_insert_iterator i(c); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp index 192d5a159560..6d682e166d5b 100644 --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp @@ -10,29 +10,41 @@ // template // back_insert_iterator -// back_inserter(Cont& x); +// back_inserter(Cont& x); // constexpr in C++20 + +// template +// front_insert_iterator +// front_inserter(Cont& x); // constexpr in C++20 -#include -#include #include -#include "nasty_containers.h" +#include +#include #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::back_insert_iterator i = std::back_inserter(c); - i = 0; + i = 3; assert(c.size() == 1); - assert(c.back() == 0); + assert(c.back() == 3); + i = 4; + assert(c.size() == 2); + assert(c.back() == 4); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp index ccdb444f11b3..c96b8527bef0 100644 --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp @@ -10,7 +10,7 @@ // front_insert_iterator -// explicit front_insert_iterator(Cont& x); +// explicit front_insert_iterator(Cont& x); // constexpr in C++20 #include #include diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp index f27178941936..9718f8c93323 100644 --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp @@ -8,9 +8,9 @@ // -// template +// template // front_insert_iterator -// front_inserter(Cont& x); +// front_inserter(Cont& x); // constexpr in C++20 #include #include @@ -25,9 +25,12 @@ TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i = std::front_inserter(c); - i = 0; + i = 3; assert(c.size() == 1); - assert(c.front() == 0); + assert(c.front() == 3); + i = 4; + assert(c.size() == 2); + assert(c.front() == 4); return true; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp index 8def436a0cc9..af2e85471ae4 100644 --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp @@ -10,7 +10,7 @@ // insert_iterator -// insert_iterator(Cont& x, Cont::iterator i); +// insert_iterator(Cont& x, Cont::iterator i); // constexpr in C++20 #include #include diff --git a/libcxx/test/support/nasty_containers.h b/libcxx/test/support/nasty_containers.h index 91251666ba73..0b56a27feefa 100644 --- a/libcxx/test/support/nasty_containers.h +++ b/libcxx/test/support/nasty_containers.h @@ -206,7 +206,7 @@ public: void push_back(const value_type& x) { l_.push_back(x); } #if TEST_STD_VER >= 11 void push_back(value_type&& x) { l_.push_back(std::forward(x)); } - void push_front(value_type&& x) { l_.push_back(std::forward(x)); } + void push_front(value_type&& x) { l_.push_front(std::forward(x)); } template void emplace_back(Args&&... args) { l_.emplace_back(std::forward(args)...); } template @@ -234,10 +234,10 @@ public: #endif iterator erase(const_iterator pos) { return l_.erase(pos); } - iterator erase(const_iterator pos, const_iterator last) { return l_.erase(pos, last); } + iterator erase(const_iterator first, const_iterator last) { return l_.erase(first, last); } - void resize(size_type) { l_.resize(); } - void resize(size_type, const value_type& c) { l_.resize(c); } + void resize(size_type n) { l_.resize(n); } + void resize(size_type n, const value_type& c) { l_.resize(n, c); } void swap(nasty_list &nl) #if TEST_STD_VER > 14