From 171cd5aedbd28a58568ed2735a88d6bdc8a04ea4 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sat, 1 Mar 2025 01:59:41 -0500 Subject: [PATCH 01/14] constexpr deque --- libcxx/include/deque | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libcxx/include/deque b/libcxx/include/deque index 95200b4801d7f..c92b89aa9f1c0 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2543,7 +2543,8 @@ inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT { } template -inline _LIBCPP_HIDE_FROM_ABI bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { +inline _LIBCPP_HIDE_FROM_ABI constexpr bool +operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { const typename deque<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); } @@ -2578,7 +2579,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, # else // _LIBCPP_STD_VER <= 17 template -_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> +_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> constexpr operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } @@ -2586,14 +2587,14 @@ operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y # endif // _LIBCPP_STD_VER <= 17 template -inline _LIBCPP_HIDE_FROM_ABI void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) +inline _LIBCPP_HIDE_FROM_ABI constexpr void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } # if _LIBCPP_STD_VER >= 20 template -inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_HIDE_FROM_ABI constexpr typename deque<_Tp, _Allocator>::size_type erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { auto __old_size = __c.size(); __c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end()); @@ -2601,7 +2602,7 @@ erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { } template -inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_HIDE_FROM_ABI constexpr typename deque<_Tp, _Allocator>::size_type erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) { auto __old_size = __c.size(); __c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end()); From caf34bf171925980dce184270b4415d97e10d568 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sat, 1 Mar 2025 14:45:24 -0500 Subject: [PATCH 02/14] use new macros --- libcxx/include/deque | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libcxx/include/deque b/libcxx/include/deque index c92b89aa9f1c0..beea24604d258 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2543,7 +2543,7 @@ inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT { } template -inline _LIBCPP_HIDE_FROM_ABI constexpr bool +inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { const typename deque<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); @@ -2579,7 +2579,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, # else // _LIBCPP_STD_VER <= 17 template -_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> constexpr +_LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Tp> constexpr operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } @@ -2587,14 +2587,14 @@ operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y # endif // _LIBCPP_STD_VER <= 17 template -inline _LIBCPP_HIDE_FROM_ABI constexpr void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) +inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } # if _LIBCPP_STD_VER >= 20 template -inline _LIBCPP_HIDE_FROM_ABI constexpr typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr typename deque<_Tp, _Allocator>::size_type erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { auto __old_size = __c.size(); __c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end()); @@ -2602,7 +2602,7 @@ erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { } template -inline _LIBCPP_HIDE_FROM_ABI constexpr typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr typename deque<_Tp, _Allocator>::size_type erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) { auto __old_size = __c.size(); __c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end()); From 7e8a820d1f61012e089e9436d56582dd0b36e723 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sat, 1 Mar 2025 15:03:32 -0500 Subject: [PATCH 03/14] update test files to reflect constexpr --- .../std/containers/sequences/deque/compare.pass.cpp | 10 +++++++++- .../sequences/deque/compare.three_way.pass.cpp | 11 +++++++++-- .../sequences/deque/deque.capacity/access.pass.cpp | 10 +++++++++- .../sequences/deque/deque.capacity/empty.pass.cpp | 9 ++++++++- .../sequences/deque/deque.capacity/max_size.pass.cpp | 10 +++++++++- .../deque/deque.capacity/resize_size.pass.cpp | 10 +++++++++- .../deque/deque.capacity/resize_size_value.pass.cpp | 10 +++++++++- .../deque/deque.capacity/shrink_to_fit.pass.cpp | 10 +++++++++- .../sequences/deque/deque.capacity/size.pass.cpp | 10 +++++++++- .../containers/sequences/deque/get_allocator.pass.cpp | 10 +++++++++- .../std/containers/sequences/deque/iterators.pass.cpp | 9 ++++++++- .../std/containers/sequences/deque/types.pass.cpp | 10 +++++++++- 12 files changed, 106 insertions(+), 13 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp index 526e3d38e7dff..25aea88911d82 100644 --- a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp @@ -37,7 +37,7 @@ #include "test_comparisons.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { const std::deque d1, d2; assert(testComparisons(d1, d2, true, false)); @@ -113,6 +113,14 @@ int main(int, char**) { const std::deque d2(items2, items2 + 2); assert(testComparisons(d1, d2, false, false)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp index 3d5646a844951..f35ef6081c866 100644 --- a/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp @@ -18,8 +18,15 @@ #include "test_container_comparisons.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { assert(test_sequence_container_spaceship()); - // `std::deque` is not constexpr, so no `static_assert` test here. + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp index 294663c5bd356..fa2ab8c2f45b1 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp @@ -47,7 +47,7 @@ C make(int size, int start = 0) { return c; } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; C c = make >(10); @@ -118,6 +118,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp index 5e3a6ec1cea82..cb684a312067b 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; C c; @@ -46,6 +46,13 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } #endif + return true; +} +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp index 39feabe3889b3..8043e8e030114 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp @@ -19,7 +19,7 @@ #include "test_allocator.h" #include "test_macros.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef limited_allocator A; typedef std::deque C; @@ -45,6 +45,14 @@ int main(int, char**) { assert(c.max_size() <= alloc_max_size(c.get_allocator())); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp index 767fe7ae8864e..8bd735a2cedd5 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp @@ -63,7 +63,7 @@ void testN(int start, int N, int M) { test(c1, M); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -90,6 +90,14 @@ int main(int, char**) { testN>>(rng[i], rng[j], rng[k]); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp index 0abd94759a50f..9e1d3ff39e18f 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp @@ -63,7 +63,7 @@ void testN(int start, int N, int M) { test(c1, M, -10); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -91,5 +91,13 @@ int main(int, char**) { } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp index 34eedf8d050b7..fed42d2b691c9 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp @@ -50,7 +50,7 @@ void testN(int start, int N) { test(c1); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -74,6 +74,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp index 5c6a34867b39a..97219518ab4c5 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; C c; @@ -72,6 +72,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp index 6b8bc6c555bcd..38cb73cfe5e28 100644 --- a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp @@ -18,7 +18,7 @@ #include "test_allocator.h" #include "test_macros.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::allocator alloc; const std::deque d(alloc); @@ -29,6 +29,14 @@ int main(int, char**) { const std::deque > d(alloc); assert(d.get_allocator() == alloc); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp index 337fd688ebcdb..604a5a79d9671 100644 --- a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp @@ -22,7 +22,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; C c; @@ -104,6 +104,13 @@ int main(int, char**) { # endif // TEST_STD_VER > 20 } #endif + return true; +} +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.pass.cpp index 8184d55873d20..da12694aa14c0 100644 --- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/types.pass.cpp @@ -77,7 +77,7 @@ void test() { ""); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { test >(); test >(); test >(); @@ -106,6 +106,14 @@ int main(int, char**) { ""); } #endif + return false; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } From 28f98a858b1e5a4e5243b108e8422278d938a9bb Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sat, 1 Mar 2025 15:17:17 -0500 Subject: [PATCH 04/14] more files updated --- .../sequences/deque/deque.cons/alloc.pass.cpp | 28 ++++++++++++------- .../assign_initializer_list.pass.cpp | 9 +++++- .../deque.cons/assign_iter_iter.pass.cpp | 4 ++- .../deque.cons/assign_size_value.pass.cpp | 10 ++++++- .../sequences/deque/deque.cons/copy.pass.cpp | 10 ++++++- .../deque/deque.cons/copy_alloc.pass.cpp | 10 ++++++- .../deque/deque.cons/deduct.pass.cpp | 10 ++++++- .../deque/deque.cons/default.pass.cpp | 10 ++++++- .../deque.cons/default_noexcept.pass.cpp | 10 ++++++- .../deque/deque.cons/dtor_noexcept.pass.cpp | 10 ++++++- .../deque/deque.cons/from_range.pass.cpp | 10 ++++++- .../deque.cons/initializer_list.pass.cpp | 10 ++++++- .../initializer_list_alloc.pass.cpp | 10 ++++++- .../deque/deque.cons/iter_iter.pass.cpp | 5 +++- .../deque/deque.cons/iter_iter_alloc.pass.cpp | 4 +++ .../deque/deque.cons/move_alloc.pass.cpp | 10 ++++++- 16 files changed, 136 insertions(+), 24 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp index 4b19ef3e22173..55bbc0652737c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp @@ -20,23 +20,31 @@ #include "min_allocator.h" template -void test(const Allocator& a) { +void test_util(const Allocator& a) { std::deque d(a); assert(d.size() == 0); assert(d.get_allocator() == a); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } -int main(int, char**) { - test(std::allocator()); - test(test_allocator(3)); +TEST_CONSTEXPR_CXX26 bool test() { + test_util(std::allocator()); + test_util(test_allocator(3)); #if TEST_STD_VER >= 11 - test(min_allocator()); - test(safe_allocator()); - test(min_allocator{}); - test(safe_allocator{}); - test(explicit_allocator()); - test(explicit_allocator{}); + test_util(min_allocator()); + test_util(safe_allocator()); + test_util(min_allocator{}); + test_util(safe_allocator{}); + test_util(explicit_allocator()); + test_util(explicit_allocator{}); +#endif + return false; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp index bc57098463eaa..6e2a5b1369e70 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::deque d; d.assign({3, 4, 5, 6}); @@ -40,6 +40,13 @@ int main(int, char**) { assert(d[3] == 6); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } + return true; +} +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp index c57eb9d08cabe..5a1b29c02ca2e 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp @@ -144,6 +144,8 @@ void test_iterators() { int main(int, char**) { basic_test(); - +#if TEST_STD_VER >= 26 + static_assert(basic_test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp index 30277125e46e1..97857088a77e4 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp @@ -55,7 +55,7 @@ void testN(int start, int N, int M) { test(c1, M, -10); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -74,6 +74,14 @@ int main(int, char**) { testN> >(rng[i], rng[j], rng[k]); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp index 9f7a429d122a3..4de61a8445f1c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp @@ -26,7 +26,7 @@ void test(const C& x) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); @@ -63,6 +63,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2)); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp index fb3ad3c25a8f1..a93a28204abab 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp @@ -26,7 +26,7 @@ void test(const C& x, const typename C::allocator_type& a) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); @@ -49,6 +49,14 @@ int main(int, char**) { test(std::deque >(ab, an, safe_allocator()), safe_allocator()); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp index c481ac59ab411..995eeb578f7b2 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp @@ -32,7 +32,7 @@ struct A {}; -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { // Test the explicit deduction guides { const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; @@ -156,6 +156,14 @@ int main(int, char**) { #endif SequenceContainerDeductionGuidesSfinaeAway>(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp index 6bfd4857f9b0a..f6fa7c642ff6c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp @@ -31,13 +31,21 @@ void test() { #endif } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { test >(); test >(); #if TEST_STD_VER >= 11 test >(); test >(); #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp index 244fef829f521..a37504dcb5568 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp @@ -29,7 +29,7 @@ struct some_alloc { void allocate(std::size_t); }; -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { #if defined(_LIBCPP_VERSION) { typedef std::deque C; @@ -48,6 +48,14 @@ int main(int, char**) { typedef std::deque> C; static_assert(!std::is_nothrow_default_constructible::value, ""); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp index f0a839484f9dc..8aa967ebe0885 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp @@ -27,7 +27,7 @@ struct some_alloc { void allocate(std::size_t); }; -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; static_assert(std::is_nothrow_destructible::value, ""); @@ -46,6 +46,14 @@ int main(int, char**) { static_assert(!std::is_nothrow_destructible::value, ""); } #endif // _LIBCPP_VERSION + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp index cfc07ab7bc797..251d6dc18d51d 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp @@ -17,7 +17,7 @@ // template R> // deque(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23 -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { for_all_iterators_and_allocators([]() { test_sequence_container([]([[maybe_unused]] const auto& c) { LIBCPP_ASSERT(c.__invariants()); @@ -31,6 +31,14 @@ int main(int, char**) { // See https://github.com/llvm/llvm-project/issues/62056. //test_exception_safety_throwing_copy(); //test_exception_safety_throwing_allocator(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp index d7df936f9413d..4c41ca54aafdd 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::deque d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -38,6 +38,14 @@ int main(int, char**) { assert(d[3] == 6); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp index f5f1a23243002..3dd1d0c4dfc6a 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp @@ -20,7 +20,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::deque> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -41,6 +41,14 @@ int main(int, char**) { assert(d[3] == 6); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp index 1f8a044d0b602..379c8a88b1d7d 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp @@ -105,6 +105,9 @@ void test_emplacable_concept() { int main(int, char**) { basic_test(); test_emplacable_concept(); - +#if TEST_STD_VER >= 26 + static_assert(basic_test()); + static_assert(test_emplacable_concept()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp index 61318c3d0f2d3..ec95a9ff7e6d1 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp @@ -101,6 +101,10 @@ void test_emplacable_concept() { int main(int, char**) { basic_test(); test_emplacable_concept(); +#if TEST_STD_VER >= 26 + static_assert(basic_test()); + static_assert(test_emplacable_concept()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp index 985d8ad9db67f..5940e05c56fd6 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp @@ -21,7 +21,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; const int* an = ab + sizeof(ab) / sizeof(ab[0]); @@ -94,6 +94,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } From 00e3607e5fd649f813e30fe85332693eb07e6201 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sat, 1 Mar 2025 15:21:40 -0500 Subject: [PATCH 05/14] feature test macros --- libcxx/docs/FeatureTestMacroTable.rst | 4 +- libcxx/include/version | 6 ++- .../complex.version.compile.pass.cpp | 42 +++++++-------- .../deque.version.compile.pass.cpp | 28 ++++++++++ .../version.version.compile.pass.cpp | 52 ++++++++++++++----- .../generate_feature_test_macro_components.py | 7 ++- 6 files changed, 102 insertions(+), 37 deletions(-) diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index dcf9838edd74b..f53ac166cffce 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -202,7 +202,7 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_algorithms`` ``201806L`` ---------------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_complex`` ``201711L`` + ``__cpp_lib_constexpr_deque`` ``202502L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_dynamic_alloc`` ``201907L`` ---------------------------------------------------------- ----------------- @@ -416,6 +416,8 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_bitset`` ``202306L`` ---------------------------------------------------------- ----------------- + ``__cpp_lib_constexpr_complex`` ``201711L`` + ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_new`` ``202406L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_constrained_equality`` *unimplemented* diff --git a/libcxx/include/version b/libcxx/include/version index 63ead9fd5d29d..c783da85fb7ea 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -64,7 +64,8 @@ __cpp_lib_constexpr_algorithms 201806L __cpp_lib_constexpr_charconv 202207L __cpp_lib_constexpr_cmath 202202L -__cpp_lib_constexpr_complex 201711L +__cpp_lib_constexpr_complex 201711L +__cpp_lib_constexpr_deque 202502L __cpp_lib_constexpr_dynamic_alloc 201907L __cpp_lib_constexpr_functional 201907L __cpp_lib_constexpr_iterator 201811L @@ -398,7 +399,7 @@ __cpp_lib_void_t 201411L # endif # define __cpp_lib_concepts 202002L # define __cpp_lib_constexpr_algorithms 201806L -# define __cpp_lib_constexpr_complex 201711L +# define __cpp_lib_constexpr_deque 202502L # define __cpp_lib_constexpr_dynamic_alloc 201907L # define __cpp_lib_constexpr_functional 201907L # define __cpp_lib_constexpr_iterator 201811L @@ -536,6 +537,7 @@ __cpp_lib_void_t 201411L # undef __cpp_lib_bind_front # define __cpp_lib_bind_front 202306L # define __cpp_lib_bitset 202306L +# define __cpp_lib_constexpr_complex 201711L # if !defined(_LIBCPP_ABI_VCRUNTIME) # define __cpp_lib_constexpr_new 202406L # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp index 3718a9e222f98..6fd155f7b4216 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp @@ -15,9 +15,9 @@ // Test the feature test macros defined by -/* Constant Value - __cpp_lib_complex_udls 201309L [C++14] - __cpp_lib_constexpr_complex 201711L [C++20] +/* Constant Value + __cpp_lib_complex_udls 201309L [C++14] + __cpp_lib_constexpr_deque 202502L [C++20] */ #include @@ -29,8 +29,8 @@ # error "__cpp_lib_complex_udls should not be defined before c++14" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif #elif TEST_STD_VER == 14 @@ -42,8 +42,8 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++14" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif #elif TEST_STD_VER == 17 @@ -55,8 +55,8 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++17" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif #elif TEST_STD_VER == 20 @@ -68,11 +68,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++20" # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++20" +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++20" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++20" +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++20" # endif #elif TEST_STD_VER == 23 @@ -84,11 +84,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++23" # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++23" +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++23" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++23" +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++23" # endif #elif TEST_STD_VER > 23 @@ -100,11 +100,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++26" # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++26" +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++26" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++26" +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26" # endif #endif // TEST_STD_VER > 23 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp index d0e4ac130c60e..6f716eeefdeef 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp @@ -17,6 +17,7 @@ /* Constant Value __cpp_lib_allocator_traits_is_always_equal 201411L [C++17] + __cpp_lib_constexpr_complex 201711L [C++26] __cpp_lib_containers_ranges 202202L [C++23] __cpp_lib_default_template_type_for_algorithm_values 202403L [C++26] __cpp_lib_erase_if 202002L [C++20] @@ -32,6 +33,10 @@ # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + # ifdef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should not be defined before c++23" # endif @@ -54,6 +59,10 @@ # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + # ifdef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should not be defined before c++23" # endif @@ -79,6 +88,10 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17" # endif +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + # ifdef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should not be defined before c++23" # endif @@ -107,6 +120,10 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20" # endif +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + # ifdef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should not be defined before c++23" # endif @@ -138,6 +155,10 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23" # endif +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + # ifndef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should be defined in c++23" # endif @@ -172,6 +193,13 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26" # endif +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++26" +# endif +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++26" +# endif + # ifndef __cpp_lib_containers_ranges # error "__cpp_lib_containers_ranges should be defined in c++26" # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index 1e4465d515e6b..8214c757f0576 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -59,7 +59,8 @@ __cpp_lib_constexpr_bitset 202207L [C++23] __cpp_lib_constexpr_charconv 202207L [C++23] __cpp_lib_constexpr_cmath 202202L [C++23] - __cpp_lib_constexpr_complex 201711L [C++20] + __cpp_lib_constexpr_complex 201711L [C++26] + __cpp_lib_constexpr_deque 202502L [C++20] __cpp_lib_constexpr_dynamic_alloc 201907L [C++20] __cpp_lib_constexpr_functional 201907L [C++20] __cpp_lib_constexpr_iterator 201811L [C++20] @@ -423,7 +424,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -1299,7 +1304,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -2277,7 +2286,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++20" +# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# endif + +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -3488,11 +3501,15 @@ # error "__cpp_lib_constexpr_cmath should not be defined before c++23" # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++20" +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++20" + +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++20" +# endif +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++20" # endif # ifndef __cpp_lib_constexpr_dynamic_alloc @@ -4928,11 +4945,15 @@ # endif # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++23" +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++26" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++23" + +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++23" +# endif +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++23" # endif # ifndef __cpp_lib_constexpr_dynamic_alloc @@ -6603,6 +6624,13 @@ # error "__cpp_lib_constexpr_complex should have the value 201711L in c++26" # endif +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++26" +# endif +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26" +# endif + # ifndef __cpp_lib_constexpr_dynamic_alloc # error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++26" # endif diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 8bf7633e985d5..41627efa51ad5 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -342,7 +342,12 @@ def add_version_header(tc): }, { "name": "__cpp_lib_constexpr_complex", - "values": {"c++20": 201711}, + "values": {"c++26": 201711}, + "headers": ["deque"], + }, + { + "name": "__cpp_lib_constexpr_deque", + "values": {"c++20": 202502}, "headers": ["complex"], }, { From 82e293bc5efe3b9e73a1f8506c6e2c9fab291a83 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sun, 2 Mar 2025 12:52:48 -0500 Subject: [PATCH 06/14] fix FTM and constexpr macro --- libcxx/docs/FeatureTestMacroTable.rst | 4 +- libcxx/include/deque | 10 ++--- libcxx/include/version | 8 ++-- .../complex.version.compile.pass.cpp | 42 +++++++++--------- .../deque.version.compile.pass.cpp | 30 ++++++------- .../version.version.compile.pass.cpp | 44 +++++++++---------- .../generate_feature_test_macro_components.py | 8 ++-- 7 files changed, 73 insertions(+), 73 deletions(-) diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index f53ac166cffce..07e76c900ca63 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -202,7 +202,7 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_algorithms`` ``201806L`` ---------------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_deque`` ``202502L`` + ``__cpp_lib_constexpr_complex`` ``201711L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_dynamic_alloc`` ``201907L`` ---------------------------------------------------------- ----------------- @@ -416,7 +416,7 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_bitset`` ``202306L`` ---------------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_complex`` ``201711L`` + ``__cpp_lib_constexpr_deque`` ``202502L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_new`` ``202406L`` ---------------------------------------------------------- ----------------- diff --git a/libcxx/include/deque b/libcxx/include/deque index beea24604d258..e277455dd785a 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2543,7 +2543,7 @@ inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT { } template -inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { const typename deque<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); @@ -2579,7 +2579,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, # else // _LIBCPP_STD_VER <= 17 template -_LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Tp> constexpr +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Tp> operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } @@ -2587,14 +2587,14 @@ operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y # endif // _LIBCPP_STD_VER <= 17 template -inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } # if _LIBCPP_STD_VER >= 20 template -inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::size_type erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { auto __old_size = __c.size(); __c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end()); @@ -2602,7 +2602,7 @@ erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { } template -inline _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr typename deque<_Tp, _Allocator>::size_type +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::size_type erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) { auto __old_size = __c.size(); __c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end()); diff --git a/libcxx/include/version b/libcxx/include/version index c783da85fb7ea..7bc75706cf9f6 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -64,8 +64,8 @@ __cpp_lib_constexpr_algorithms 201806L __cpp_lib_constexpr_charconv 202207L __cpp_lib_constexpr_cmath 202202L -__cpp_lib_constexpr_complex 201711L -__cpp_lib_constexpr_deque 202502L +__cpp_lib_constexpr_complex 201711L +__cpp_lib_constexpr_deque 202502L __cpp_lib_constexpr_dynamic_alloc 201907L __cpp_lib_constexpr_functional 201907L __cpp_lib_constexpr_iterator 201811L @@ -399,7 +399,7 @@ __cpp_lib_void_t 201411L # endif # define __cpp_lib_concepts 202002L # define __cpp_lib_constexpr_algorithms 201806L -# define __cpp_lib_constexpr_deque 202502L +# define __cpp_lib_constexpr_complex 201711L # define __cpp_lib_constexpr_dynamic_alloc 201907L # define __cpp_lib_constexpr_functional 201907L # define __cpp_lib_constexpr_iterator 201811L @@ -537,7 +537,7 @@ __cpp_lib_void_t 201411L # undef __cpp_lib_bind_front # define __cpp_lib_bind_front 202306L # define __cpp_lib_bitset 202306L -# define __cpp_lib_constexpr_complex 201711L +# define __cpp_lib_constexpr_deque 202502L # if !defined(_LIBCPP_ABI_VCRUNTIME) # define __cpp_lib_constexpr_new 202406L # endif diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp index 6fd155f7b4216..3718a9e222f98 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.compile.pass.cpp @@ -15,9 +15,9 @@ // Test the feature test macros defined by -/* Constant Value - __cpp_lib_complex_udls 201309L [C++14] - __cpp_lib_constexpr_deque 202502L [C++20] +/* Constant Value + __cpp_lib_complex_udls 201309L [C++14] + __cpp_lib_constexpr_complex 201711L [C++20] */ #include @@ -29,8 +29,8 @@ # error "__cpp_lib_complex_udls should not be defined before c++14" # endif -# ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif #elif TEST_STD_VER == 14 @@ -42,8 +42,8 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++14" # endif -# ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif #elif TEST_STD_VER == 17 @@ -55,8 +55,8 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++17" # endif -# ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# ifdef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif #elif TEST_STD_VER == 20 @@ -68,11 +68,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++20" # endif -# ifndef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should be defined in c++20" +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++20" # endif -# if __cpp_lib_constexpr_deque != 202502L -# error "__cpp_lib_constexpr_deque should have the value 202502L in c++20" +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++20" # endif #elif TEST_STD_VER == 23 @@ -84,11 +84,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++23" # endif -# ifndef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should be defined in c++23" +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++23" # endif -# if __cpp_lib_constexpr_deque != 202502L -# error "__cpp_lib_constexpr_deque should have the value 202502L in c++23" +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++23" # endif #elif TEST_STD_VER > 23 @@ -100,11 +100,11 @@ # error "__cpp_lib_complex_udls should have the value 201309L in c++26" # endif -# ifndef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should be defined in c++26" +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++26" # endif -# if __cpp_lib_constexpr_deque != 202502L -# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26" +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++26" # endif #endif // TEST_STD_VER > 23 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp index 6f716eeefdeef..1cc6fbcf49944 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp @@ -17,7 +17,7 @@ /* Constant Value __cpp_lib_allocator_traits_is_always_equal 201411L [C++17] - __cpp_lib_constexpr_complex 201711L [C++26] + __cpp_lib_constexpr_deque 202502L [C++26] __cpp_lib_containers_ranges 202202L [C++23] __cpp_lib_default_template_type_for_algorithm_values 202403L [C++26] __cpp_lib_erase_if 202002L [C++20] @@ -33,8 +33,8 @@ # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_containers_ranges @@ -59,8 +59,8 @@ # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_containers_ranges @@ -88,8 +88,8 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_containers_ranges @@ -120,8 +120,8 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_containers_ranges @@ -155,8 +155,8 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifndef __cpp_lib_containers_ranges @@ -193,11 +193,11 @@ # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26" # endif -# ifndef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should be defined in c++26" +# ifndef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should be defined in c++26" # endif -# if __cpp_lib_constexpr_complex != 201711L -# error "__cpp_lib_constexpr_complex should have the value 201711L in c++26" +# if __cpp_lib_constexpr_deque != 202502L +# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26" # endif # ifndef __cpp_lib_containers_ranges diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index 8214c757f0576..27f901998b0de 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -59,8 +59,8 @@ __cpp_lib_constexpr_bitset 202207L [C++23] __cpp_lib_constexpr_charconv 202207L [C++23] __cpp_lib_constexpr_cmath 202202L [C++23] - __cpp_lib_constexpr_complex 201711L [C++26] - __cpp_lib_constexpr_deque 202502L [C++20] + __cpp_lib_constexpr_complex 201711L [C++20] + __cpp_lib_constexpr_deque 202502L [C++26] __cpp_lib_constexpr_dynamic_alloc 201907L [C++20] __cpp_lib_constexpr_functional 201907L [C++20] __cpp_lib_constexpr_iterator 201811L [C++20] @@ -424,11 +424,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -1304,11 +1304,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -2286,11 +2286,11 @@ # endif # ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# error "__cpp_lib_constexpr_complex should not be defined before c++20" # endif # ifdef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should not be defined before c++20" +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifdef __cpp_lib_constexpr_dynamic_alloc @@ -3501,15 +3501,15 @@ # error "__cpp_lib_constexpr_cmath should not be defined before c++23" # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++20" # endif - -# ifndef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should be defined in c++20" +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++20" # endif -# if __cpp_lib_constexpr_deque != 202502L -# error "__cpp_lib_constexpr_deque should have the value 202502L in c++20" + +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifndef __cpp_lib_constexpr_dynamic_alloc @@ -4945,15 +4945,15 @@ # endif # endif -# ifdef __cpp_lib_constexpr_complex -# error "__cpp_lib_constexpr_complex should not be defined before c++26" +# ifndef __cpp_lib_constexpr_complex +# error "__cpp_lib_constexpr_complex should be defined in c++23" # endif - -# ifndef __cpp_lib_constexpr_deque -# error "__cpp_lib_constexpr_deque should be defined in c++23" +# if __cpp_lib_constexpr_complex != 201711L +# error "__cpp_lib_constexpr_complex should have the value 201711L in c++23" # endif -# if __cpp_lib_constexpr_deque != 202502L -# error "__cpp_lib_constexpr_deque should have the value 202502L in c++23" + +# ifdef __cpp_lib_constexpr_deque +# error "__cpp_lib_constexpr_deque should not be defined before c++26" # endif # ifndef __cpp_lib_constexpr_dynamic_alloc diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 41627efa51ad5..985c81c56f0d1 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -342,13 +342,13 @@ def add_version_header(tc): }, { "name": "__cpp_lib_constexpr_complex", - "values": {"c++26": 201711}, - "headers": ["deque"], + "values": {"c++20": 201711}, + "headers": ["complex"], }, { "name": "__cpp_lib_constexpr_deque", - "values": {"c++20": 202502}, - "headers": ["complex"], + "values": {"c++26": 202502}, + "headers": ["deque"], }, { "name": "__cpp_lib_constexpr_dynamic_alloc", From 129f6d6066dedd413480f4403b0e75c35b06ea60 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sun, 2 Mar 2025 13:00:52 -0500 Subject: [PATCH 07/14] update more test files --- .../sequences/deque/deque.cons/deduct.verify.cpp | 10 +++++++++- .../sequences/deque/deque.cons/move.pass.cpp | 10 +++++++++- .../sequences/deque/deque.cons/move_assign.pass.cpp | 12 ++++++++++-- .../deque/deque.cons/move_noexcept.pass.cpp | 12 ++++++++++-- .../sequences/deque/deque.cons/op_equal.pass.cpp | 12 ++++++++++-- .../deque.cons/op_equal_initializer_list.pass.cpp | 11 ++++++++++- .../sequences/deque/deque.cons/size.pass.cpp | 10 +++++++++- .../sequences/deque/deque.cons/size_value.pass.cpp | 13 +++++++++++-- .../deque/deque.cons/size_value_alloc.pass.cpp | 12 ++++++++++-- .../sequences/deque/deque.erasure/erase.pass.cpp | 10 +++++++++- .../sequences/deque/deque.erasure/erase_if.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/append_range.pass.cpp | 11 ++++++++++- 12 files changed, 116 insertions(+), 17 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp index 61e58b08ca263..cbdcee4be91f5 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp @@ -22,7 +22,7 @@ struct A {}; -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { // Test the explicit deduction guides // Test the implicit deduction guides @@ -34,6 +34,14 @@ int main(int, char**) { // Also, we can't use {} instead of parens, because that constructs a // deque, allocator>> } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp index 66ff168cc83b7..ce4f6f5cd8eb6 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp @@ -21,7 +21,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); @@ -79,6 +79,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp index 426dea0347101..87f6b5a35ad5e 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp @@ -21,8 +21,8 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) { - { +TEST_CONSTEXPR_CXX26 bool test() { + { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); typedef test_allocator A; @@ -98,6 +98,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp index 37e8a801e9d71..194487e64c848 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp @@ -29,8 +29,8 @@ struct some_alloc { void allocate(std::size_t); }; -int main(int, char**) { -#if defined(_LIBCPP_VERSION) +TEST_CONSTEXPR_CXX26 bool test() { + #if defined(_LIBCPP_VERSION) { typedef std::deque C; static_assert(std::is_nothrow_move_constructible::value, ""); @@ -48,6 +48,14 @@ int main(int, char**) { static_assert(!std::is_nothrow_move_constructible::value, ""); } #endif // _LIBCPP_VERSION + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp index 05d172268e0bd..89f8b0a0a0f98 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp @@ -26,8 +26,8 @@ void test(const C& x) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x)); } -int main(int, char**) { - { +TEST_CONSTEXPR_CXX26 bool test() { + { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); test(std::deque(ab, an)); @@ -66,6 +66,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2)); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp index b2760b4a3ff49..5be8753ed08bb 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::deque d; d = {3, 4, 5, 6}; @@ -40,6 +40,15 @@ int main(int, char**) { assert(d[3] == 6); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } + return true; +} + + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp index f8f42bd668f83..542288aefc3d0 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp @@ -82,7 +82,7 @@ void test(unsigned n) { test2(n); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { test >(0); test >(1); test >(10); @@ -107,6 +107,14 @@ int main(int, char**) { test3>(1); test3>(3); #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp index 231aa9c44c663..78590d7b87954 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp @@ -31,8 +31,8 @@ void test(unsigned n, const T& x) { assert(*i == x); } -int main(int, char**) { - test >(0, 5); +TEST_CONSTEXPR_CXX26 bool tests() { + test >(0, 5); test >(1, 10); test >(10, 11); test >(1023, -11); @@ -48,6 +48,15 @@ int main(int, char**) { #if TEST_STD_VER >= 11 test >(4095, 90); #endif + return true; +} + + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp index f8ea37e64d9eb..d9c9cb8b41c6e 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp @@ -31,8 +31,8 @@ void test(unsigned n, const T& x, const Allocator& a) { assert(*i == x); } -int main(int, char**) { - { +TEST_CONSTEXPR_CXX26 bool tests() { + { std::allocator a; test(0, 5, a); test(1, 10, a); @@ -64,6 +64,14 @@ int main(int, char**) { test(4097, 157, a); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp index 947e06bd64375..583a229775d02 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp @@ -66,7 +66,7 @@ void test() { test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { test>(); test>>(); test>>(); @@ -74,6 +74,14 @@ int main(int, char**) { test>(); test>(); + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp index ed5220422dab2..365bd1e88a881 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp @@ -68,7 +68,7 @@ void test() { test0(S({1, 2, 3}), False, S({1, 2, 3}), 0); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { test>(); test>>(); test>>(); @@ -76,6 +76,14 @@ int main(int, char**) { test>(); test>(); + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp index 56a1d226db46f..c03212a12c011 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp @@ -22,7 +22,8 @@ // {empty/one-element/full} container); // - appending move-only elements; // - an exception is thrown when copying the elements or when allocating new elements. -int main(int, char**) { + +TEST_CONSTEXPR_CXX26 bool test() { static_assert(test_constraints_append_range()); for_all_iterators_and_allocators([]() { @@ -34,6 +35,14 @@ int main(int, char**) { test_append_range_exception_safety_throwing_copy(); test_append_range_exception_safety_throwing_allocator(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } From 7494b331799c63a61253c6767a24b319573bc06c Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sun, 2 Mar 2025 13:02:44 -0500 Subject: [PATCH 08/14] clang-format --- .../containers/sequences/deque/deque.cons/move_assign.pass.cpp | 2 +- .../sequences/deque/deque.cons/move_noexcept.pass.cpp | 2 +- .../containers/sequences/deque/deque.cons/op_equal.pass.cpp | 2 +- .../deque/deque.cons/op_equal_initializer_list.pass.cpp | 1 - .../containers/sequences/deque/deque.cons/size_value.pass.cpp | 3 +-- .../sequences/deque/deque.cons/size_value_alloc.pass.cpp | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp index 87f6b5a35ad5e..06a6ae95e1b3c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp @@ -22,7 +22,7 @@ #include "min_allocator.h" TEST_CONSTEXPR_CXX26 bool test() { - { + { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); typedef test_allocator A; diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp index 194487e64c848..0b817ca34011c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp @@ -30,7 +30,7 @@ struct some_alloc { }; TEST_CONSTEXPR_CXX26 bool test() { - #if defined(_LIBCPP_VERSION) +#if defined(_LIBCPP_VERSION) { typedef std::deque C; static_assert(std::is_nothrow_move_constructible::value, ""); diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp index 89f8b0a0a0f98..1905db90c4156 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp @@ -27,7 +27,7 @@ void test(const C& x) { } TEST_CONSTEXPR_CXX26 bool test() { - { + { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab) / sizeof(ab[0]); test(std::deque(ab, an)); diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp index 5be8753ed08bb..0a1743ff7c678 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp @@ -43,7 +43,6 @@ TEST_CONSTEXPR_CXX26 bool test() { return true; } - int main(int, char**) { test(); #if TEST_STD_VER >= 26 diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp index 78590d7b87954..caeea946d0461 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp @@ -32,7 +32,7 @@ void test(unsigned n, const T& x) { } TEST_CONSTEXPR_CXX26 bool tests() { - test >(0, 5); + test >(0, 5); test >(1, 10); test >(10, 11); test >(1023, -11); @@ -51,7 +51,6 @@ TEST_CONSTEXPR_CXX26 bool tests() { return true; } - int main(int, char**) { tests(); #if TEST_STD_VER >= 26 diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp index d9c9cb8b41c6e..4fd29052d59f1 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp @@ -32,7 +32,7 @@ void test(unsigned n, const T& x, const Allocator& a) { } TEST_CONSTEXPR_CXX26 bool tests() { - { + { std::allocator a; test(0, 5, a); test(1, 10, a); From ed3b84341d7b2a0e92a281c6c797cd3115946711 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sun, 2 Mar 2025 13:08:11 -0500 Subject: [PATCH 09/14] clang format --- libcxx/include/deque | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/include/deque b/libcxx/include/deque index e277455dd785a..f7cd7a8ae2ecf 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2587,8 +2587,8 @@ operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y # endif // _LIBCPP_STD_VER <= 17 template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) - _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void +swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } From 457ae753db91763457bfb051e252dca4f44bc430 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Sun, 2 Mar 2025 13:41:20 -0500 Subject: [PATCH 10/14] add more macros --- libcxx/include/deque | 109 ++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/libcxx/include/deque b/libcxx/include/deque index f7cd7a8ae2ecf..54d0556eddd70 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -605,7 +605,8 @@ private: public: // construct/copy/destroy: - _LIBCPP_HIDE_FROM_ABI deque() _NOEXCEPT_(is_nothrow_default_constructible::value) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque() + _NOEXCEPT_(is_nothrow_default_constructible::value) : __start_(0), __size_(0) { __annotate_new(0); } @@ -619,19 +620,20 @@ public: __alloc_traits::deallocate(__alloc(), *__i, __block_size); } - _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit deque(const allocator_type& __a) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); } explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n); # if _LIBCPP_STD_VER >= 14 - explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a); + explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque(size_type __n, const _Allocator& __a); # endif _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 + deque(size_type __n, const value_type& __v, const allocator_type& __a) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); if (__n > 0) @@ -641,11 +643,12 @@ public: template ::value, int> = 0> _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l); template ::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque(_InputIter __f, _InputIter __l, const allocator_type& __a); # if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> - _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 + deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { __append_with_size(ranges::begin(__range), ranges::distance(__range)); @@ -658,8 +661,9 @@ public: } # endif - _LIBCPP_HIDE_FROM_ABI deque(const deque& __c); - _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t& __a); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque(const deque& __c); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 + deque(const deque& __c, const __type_identity_t& __a); _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c); @@ -667,13 +671,14 @@ public: _LIBCPP_HIDE_FROM_ABI deque(initializer_list __il); _LIBCPP_HIDE_FROM_ABI deque(initializer_list __il, const allocator_type& __a); - _LIBCPP_HIDE_FROM_ABI deque& operator=(initializer_list __il) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque& operator=(initializer_list __il) { assign(__il); return *this; } - _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) noexcept(is_nothrow_move_constructible::value); - _LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t& __a); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 + deque(deque&& __c) noexcept(is_nothrow_move_constructible::value); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 deque(deque&& __c, const __type_identity_t& __a); _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c) noexcept( (__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value) || @@ -709,67 +714,81 @@ public: _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v); - _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __alloc_; } _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __alloc_; } // iterators: - _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { __map_pointer __mp = __map_.begin() + __start_ / __block_size; return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); } - _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); } - _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { size_type __p = size() + __start_; __map_pointer __mp = __map_.begin() + __p / __block_size; return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); } - _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { size_type __p = size() + __start_; __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); } - _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } - _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); } - _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } - _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT { + return reverse_iterator(end()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const _NOEXCEPT { + return const_reverse_iterator(end()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT { + return reverse_iterator(begin()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT { + return const_reverse_iterator(begin()); + } - _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } - _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } - _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(end()); } - _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(begin()); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { return begin(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { return end(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const _NOEXCEPT { + return const_reverse_iterator(end()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { + return const_reverse_iterator(begin()); + } // capacity: - _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __size(); } _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_; } _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_; } - _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT { return std::min(__alloc_traits::max_size(__alloc()), numeric_limits::max()); } - _LIBCPP_HIDE_FROM_ABI void resize(size_type __n); - _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v); - _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; - [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void resize(size_type __n); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void resize(size_type __n, const value_type& __v); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void shrink_to_fit() _NOEXCEPT; + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT { + return size() == 0; + } // element access: - _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI reference at(size_type __i); - _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const; - _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator[](size_type __i) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reference operator[](size_type __i) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference at(size_type __i); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reference at(size_type __i) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference front() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reference front() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference back() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reference back() const _NOEXCEPT; // 23.2.2.3 modifiers: _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v); @@ -789,8 +808,8 @@ public: template _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args); - _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v); - _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void push_front(value_type&& __v); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void push_back(value_type&& __v); # if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> @@ -1570,7 +1589,7 @@ inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>:: } template -void deque<_Tp, _Allocator>::push_back(const value_type& __v) { +void _LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::push_back(const value_type& __v) { allocator_type& __a = __alloc(); if (__back_spare() == 0) __add_back_capacity(); @@ -1658,7 +1677,8 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) { } template -typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) { +_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) { size_type __pos = __p - begin(); size_type __to_end = size() - __pos; allocator_type& __a = __alloc(); @@ -1755,7 +1775,8 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_ # endif // _LIBCPP_CXX03_LANG template -typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) { +_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) { size_type __pos = __p - begin(); size_type __to_end = size() - __pos; allocator_type& __a = __alloc(); @@ -1807,7 +1828,7 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_i } template -typename deque<_Tp, _Allocator>::iterator +typename deque<_Tp, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) { size_type __pos = __p - begin(); size_type __to_end = __size() - __pos; From 37374996ccdc9f42c2ed1fcc662fd286febda7de Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Tue, 8 Apr 2025 23:04:43 -0400 Subject: [PATCH 11/14] fix ftm --- libcxx/docs/FeatureTestMacroTable.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index 79430a7875b1f..bd73a1d933cb1 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -416,10 +416,10 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_bitset`` ``202306L`` ---------------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_deque`` ``202502L`` - ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_algorithms`` ``202306L`` ---------------------------------------------------------- ----------------- + ``__cpp_lib_constexpr_deque`` ``202502L`` + ---------------------------------------------------------- ----------------- ``__cpp_lib_constexpr_new`` ``202406L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_constrained_equality`` *unimplemented* From 5f9a116d9959272a7701e35d85ad7894e32438d7 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Tue, 8 Apr 2025 23:12:37 -0400 Subject: [PATCH 12/14] fix version --- libcxx/include/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx/include/version b/libcxx/include/version index b016292218b3f..e451e49fe1a3d 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -538,9 +538,9 @@ __cpp_lib_void_t 201411L # undef __cpp_lib_bind_front # define __cpp_lib_bind_front 202306L # define __cpp_lib_bitset 202306L -# define __cpp_lib_constexpr_deque 202502L # undef __cpp_lib_constexpr_algorithms # define __cpp_lib_constexpr_algorithms 202306L +# define __cpp_lib_constexpr_deque 202502L # if !defined(_LIBCPP_ABI_VCRUNTIME) # define __cpp_lib_constexpr_new 202406L # endif From 630e5c5c831114e62779405a7238515da3dbd6d7 Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Tue, 8 Apr 2025 23:17:01 -0400 Subject: [PATCH 13/14] update test files in deque.modifiers --- .../deque/deque.modifiers/assign_range.pass.cpp | 11 ++++++++++- .../sequences/deque/deque.modifiers/clear.pass.cpp | 10 +++++++++- .../sequences/deque/deque.modifiers/emplace.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/emplace_back.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/emplace_front.pass.cpp | 10 +++++++++- .../deque.modifiers/erase_iter.invalidation.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/erase_iter.pass.cpp | 10 +++++++++- .../erase_iter_iter.invalidation.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/erase_iter_iter.pass.cpp | 10 +++++++++- .../insert_iter_initializer_list.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/insert_iter_iter.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/insert_range.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/insert_rvalue.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/insert_size_value.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/insert_value.pass.cpp | 10 +++++++++- .../deque.modifiers/pop_back.invalidation.pass.cpp | 10 +++++++++- .../sequences/deque/deque.modifiers/pop_back.pass.cpp | 10 +++++++++- .../deque.modifiers/pop_front.invalidation.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/pop_front.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/prepend_range.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/push_back.pass.cpp | 10 +++++++++- .../push_back_exception_safety.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/push_back_rvalue.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/push_front.pass.cpp | 10 +++++++++- .../push_front_exception_safety.pass.cpp | 10 +++++++++- .../deque/deque.modifiers/push_front_rvalue.pass.cpp | 10 +++++++++- 26 files changed, 235 insertions(+), 26 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp index 744e03a7b983e..556532a3919ae 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp @@ -21,7 +21,8 @@ // {empty/one-element/full} container); // - assigning move-only elements; // - an exception is thrown when copying the elements or when allocating new elements. -int main(int, char**) { + +TEST_CONSTEXPR_CXX26 bool test() { static_assert(test_constraints_assign_range()); for_all_iterators_and_allocators([]() { @@ -33,6 +34,14 @@ int main(int, char**) { test_assign_range_exception_safety_throwing_copy(); test_assign_range_exception_safety_throwing_allocator(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp index bb2fa6e52af43..cb422c90c8e29 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp @@ -18,7 +18,7 @@ #include "../../../NotConstructible.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef NotConstructible T; typedef std::deque C; @@ -69,6 +69,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp index 7c90216a9ce56..1667d6a80aa72 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp @@ -74,7 +74,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -96,6 +96,14 @@ int main(int, char**) { for (int j = 0; j < N; ++j) testN> >(rng[i], rng[j]); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp index 590ab432dd519..f10363846fbbc 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp @@ -68,7 +68,7 @@ void testN(int start, int N) { test(c1); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -98,6 +98,14 @@ int main(int, char**) { assert(c.size() == 4); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp index 3fbaee1fc1587..d77535e83a635 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp @@ -68,7 +68,7 @@ void testN(int start, int N) { test(c1); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -98,6 +98,14 @@ int main(int, char**) { assert(c.size() == 4); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp index b538b0f037ab1..3de0d555f6642 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp @@ -56,7 +56,7 @@ void del_at_end(C c) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { std::deque queue; for (int i = 0; i < 20; ++i) queue.push_back(i); @@ -66,6 +66,14 @@ int main(int, char**) { del_at_end(queue); queue.pop_back(); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp index 2d40f0c449f4d..3833a79443596 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp @@ -93,7 +93,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -126,6 +126,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v)); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp index 320d4771a2fc7..25b194bccf7fe 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp @@ -60,7 +60,7 @@ void del_at_end(C c, std::size_t num) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { std::deque queue; for (int i = 0; i < 20; ++i) queue.push_back(i); @@ -72,6 +72,14 @@ int main(int, char**) { } queue.pop_back(); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp index 1eaa7a6c72a57..3e757935b31af 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp @@ -99,7 +99,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -132,6 +132,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v)); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp index 117ce63b93d7e..5af86445069b9 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { std::deque d(10, 1); std::deque::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -62,6 +62,14 @@ int main(int, char**) { assert(d[13] == 1); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d)); } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp index 3941c1e8bc6c5..7da62fe7082de 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp @@ -235,7 +235,7 @@ void test_move() { #endif } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -270,6 +270,14 @@ int main(int, char**) { test_move > >(); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp index 7681eb63b9076..b818ab5b7a91c 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp @@ -26,7 +26,7 @@ // {empty/one-element/full} container at the {beginning/middle/end}); // - inserting move-only elements; // - an exception is thrown when copying the elements or when allocating new elements. -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { static_assert(test_constraints_insert_range()); for_all_iterators_and_allocators([]() { @@ -38,6 +38,14 @@ int main(int, char**) { test_insert_range_exception_safety_throwing_copy(); test_insert_range_exception_safety_throwing_allocator(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp index ff4654cf0ccb3..8ab016ef2a6c1 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp @@ -80,7 +80,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -102,6 +102,14 @@ int main(int, char**) { for (int j = 0; j < N; ++j) testN> >(rng[i], rng[j]); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp index 05a16a9e76387..62df9952e1b4e 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp @@ -113,7 +113,7 @@ void self_reference_test() { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -143,6 +143,14 @@ int main(int, char**) { self_reference_test> >(); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp index b9440acb4986a..e13944e458862 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp @@ -99,7 +99,7 @@ void self_reference_test() { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -126,6 +126,14 @@ int main(int, char**) { self_reference_test> >(); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp index 3d0133e362b6a..baa9202524d70 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp @@ -37,7 +37,7 @@ void test(C c) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { std::deque queue; for (int i = 0; i < 4098; ++i) queue.push_back(i); @@ -47,6 +47,14 @@ int main(int, char**) { queue.pop_back(); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue)); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp index 301d8e3342bb6..bb51057837cb4 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp @@ -58,7 +58,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -82,6 +82,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp index c857c3038d49e..35518330040cb 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp @@ -36,7 +36,7 @@ void test(C c) { assert(&*it2 == &*it4); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { std::deque queue; for (int i = 0; i < 4098; ++i) queue.push_back(i); @@ -46,6 +46,14 @@ int main(int, char**) { queue.pop_back(); LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue)); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp index 2bd390ac315e0..54226d4c7f331 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp @@ -58,7 +58,7 @@ void testN(int start, int N) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -75,6 +75,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp index 3154cd389d2f0..ae62d60ebe6b4 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp @@ -22,7 +22,7 @@ // {empty/one-element/full} container); // - prepending move-only elements; // - an exception is thrown when copying the elements or when allocating new elements. -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { static_assert(test_constraints_prepend_range()); for_all_iterators_and_allocators([]() { @@ -34,6 +34,14 @@ int main(int, char**) { test_prepend_range_exception_safety_throwing_copy(); test_prepend_range_exception_safety_throwing_allocator(); + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp index fff3433ab4dd4..b63f802ee02ad 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp @@ -51,7 +51,7 @@ void test(int size) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -66,6 +66,14 @@ int main(int, char**) { test> >(rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp index 10da5b02f96f1..68e4be4387fb4 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp @@ -68,7 +68,7 @@ CMyClass::~CMyClass() { bool operator==(const CMyClass& lhs, const CMyClass& rhs) { return lhs.equal(rhs); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { CMyClass instance(42); { std::deque vec; @@ -100,6 +100,14 @@ int main(int, char**) { assert(vec == vec2); } } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp index c9e0ca7a6d7e0..1e12650d6234b 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp @@ -54,7 +54,7 @@ void test(int size) { } } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -73,6 +73,14 @@ int main(int, char**) { for (int j = 0; j < N; ++j) test> >(rng[j]); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp index 1fb8341895a35..50ac046e14453 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp @@ -58,7 +58,7 @@ void testN(int start, int N) { test(c1, -10); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -82,6 +82,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp index f4b77bcf09f62..76ad9367cce25 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp @@ -68,7 +68,7 @@ CMyClass::~CMyClass() { bool operator==(const CMyClass& lhs, const CMyClass& rhs) { return lhs.equal(rhs); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { CMyClass instance(42); { std::deque vec; @@ -100,6 +100,14 @@ int main(int, char**) { assert(vec == vec2); } } + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp index 418a0c976e66c..24e2bcb5f1c3a 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp @@ -61,7 +61,7 @@ void testN(int start, int N) { test(c1, -10); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -76,6 +76,14 @@ int main(int, char**) { for (int j = 0; j < N; ++j) testN> >(rng[i], rng[j]); } + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } From 5162d6c1b23d79c7e1c37b7b4ad3d5e5dfc6429e Mon Sep 17 00:00:00 2001 From: changkhothuychung Date: Tue, 8 Apr 2025 23:19:53 -0400 Subject: [PATCH 14/14] fix test files in deque.special --- .../sequences/deque/deque.special/copy.pass.cpp | 10 +++++++++- .../deque/deque.special/copy_backward.pass.cpp | 10 +++++++++- .../sequences/deque/deque.special/move.pass.cpp | 10 +++++++++- .../deque/deque.special/move_backward.pass.cpp | 10 +++++++++- .../sequences/deque/deque.special/swap.pass.cpp | 10 +++++++++- .../deque/deque.special/swap_noexcept.pass.cpp | 10 +++++++++- 6 files changed, 54 insertions(+), 6 deletions(-) diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp index 382d6e530b24f..dc926670de6f7 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp @@ -76,7 +76,7 @@ void testN(int start, int N) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -93,6 +93,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp index 1414f03a549c1..cc6f6a77e8ed6 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp @@ -75,7 +75,7 @@ void testN(int start, int N) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -92,6 +92,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp index 4b24141db3cee..de4c65c7eba0e 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp @@ -75,7 +75,7 @@ void testN(int start, int N) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -92,6 +92,14 @@ int main(int, char**) { testN> >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp index 726abe7617aef..523a479eef005 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp @@ -75,7 +75,7 @@ void testN(int start, int N) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -92,6 +92,14 @@ int main(int, char**) { testN > >(rng[i], rng[j]); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp index 07004315a0bfb..13a1b8735e0d8 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp @@ -52,7 +52,7 @@ void testN(int start, int N, int M) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2_save)); } -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool tests() { { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng) / sizeof(rng[0]); @@ -113,6 +113,14 @@ int main(int, char**) { LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2)); } #endif + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER >= 26 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp index 6347496d67c15..97c61322f4e73 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp @@ -52,7 +52,7 @@ struct some_alloc2 { typedef std::true_type is_always_equal; }; -int main(int, char**) { +TEST_CONSTEXPR_CXX26 bool test() { { typedef std::deque C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); @@ -83,6 +83,14 @@ int main(int, char**) { static_assert(noexcept(swap(std::declval(), std::declval())), ""); } #endif + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 26 + static_assert(test()); +#endif return 0; }