This was removed by P2868R3, voted into the C++26 draft at the November 2023 meeting in Kona. We've had a deprecated warning in place for three years.
libstdc++-v3/ChangeLog: * include/bits/allocator.h (allocator::is_always_equal): Do not define for C++26. (allocator<void>::is_always_equal): Likewise. * testsuite/20_util/allocator/requirements/typedefs.cc: Check that is_always_equal is not present in C++26. * testsuite/20_util/allocator/void.cc: Do not require is_always_equal for C++26. * testsuite/23_containers/vector/bool/cons/constexpr.cc: Add missing override of base's is_always_equal. * testsuite/23_containers/vector/cons/constexpr.cc: Likewise. --- Tested x86_64-linux. Pushed to trunk. libstdc++-v3/include/bits/allocator.h | 4 ++++ .../20_util/allocator/requirements/typedefs.cc | 14 +++++++++++--- libstdc++-v3/testsuite/20_util/allocator/void.cc | 4 +++- .../23_containers/vector/bool/cons/constexpr.cc | 4 ++++ .../23_containers/vector/cons/constexpr.cc | 4 ++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index ebb487a3ffe..ce678480571 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -95,9 +95,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // 2103. std::allocator propagate_on_container_move_assignment using propagate_on_container_move_assignment = true_type; +#if __cplusplus <= 202302L using is_always_equal _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") = true_type; +#endif #if __cplusplus >= 202002L // As noted above, these members are present for C++20 to provide the @@ -152,9 +154,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // 2103. std::allocator propagate_on_container_move_assignment using propagate_on_container_move_assignment = true_type; +#if __cplusplus <= 202302L using is_always_equal _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") = true_type; +#endif #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS diff --git a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc index 49d99e52415..1572f891246 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc @@ -54,9 +54,13 @@ static_assert( is_same<allocator<int>::propagate_on_container_move_assignment, std::true_type>::value, "propagate_on_container_move_assignment" ); -using IAE = allocator<int>::is_always_equal; // { dg-warning "deprecated" "" { target c++20 } } +#if __cplusplus <= 202302L +using IAE = allocator<int>::is_always_equal; // { dg-warning "deprecated" "" { target { c++20_only || c++23_only } } } static_assert( is_same<IAE, std::true_type>::value, "is_always_equal" ); - +#else +struct B { using is_always_equal = int; }; +struct tester : B, std::allocator<int> { is_always_equal unambig; }; +#endif // Test required typedefs for allocator<void> specialization. static_assert( is_same<allocator<void>::value_type, void>::value, @@ -75,6 +79,10 @@ static_assert( is_same<allocator<void>::propagate_on_container_move_assignment, std::true_type>::value, "propagate_on_container_move_assignment" ); -using VIAE = allocator<void>::is_always_equal; // { dg-warning "deprecated" "" { target c++20 } } +#if __cplusplus <= 202302L +using VIAE = allocator<void>::is_always_equal; // { dg-warning "deprecated" "" { target { c++20_only || c++23_only } } } static_assert( is_same<VIAE, std::true_type>::value, "is_always_equal" ); +#else +struct tester2 : B, std::allocator<void> { is_always_equal unambig; }; +#endif #endif diff --git a/libstdc++-v3/testsuite/20_util/allocator/void.cc b/libstdc++-v3/testsuite/20_util/allocator/void.cc index 04cd2094776..799774861f5 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/void.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/void.cc @@ -36,8 +36,10 @@ test01() static_assert( std::allocator<void>::propagate_on_container_move_assignment(), "POCMA trait should always be present" ); +#if __cplusplus <= 202302L static_assert( std::allocator<void>::is_always_equal(), - "is_always_equal trait should always be present" ); + "is_always_equal trait should be present before C++26" ); +#endif static_assert( std::is_same<std::allocator<void>::size_type, std::size_t>(), diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc index 88d99fe682f..fad45e0fb17 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc @@ -14,6 +14,10 @@ struct Alloc : std::allocator<T> template<typename U> constexpr Alloc(const Alloc<U>& a) : personality(a.personality) { } +#if __cplusplus <= 202302L + using is_always_equal = std::false_type; +#endif + int personality = 0; constexpr Alloc select_on_container_copy_construction() const diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc index fa78676b300..713223bd6f2 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc @@ -22,6 +22,10 @@ struct Alloc : std::allocator<T> template<typename U> constexpr Alloc(const Alloc<U>& a) : personality(a.personality) { } +#if __cplusplus <= 202302L + using is_always_equal = std::false_type; +#endif + int personality = 0; constexpr Alloc select_on_container_copy_construction() const -- 2.47.1