]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Remove std::allocator::is_always_equal typedef for C++26
authorJonathan Wakely <jwakely@redhat.com>
Thu, 28 Nov 2024 21:01:13 +0000 (21:01 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 9 Dec 2024 15:18:27 +0000 (15:18 +0000)
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.

libstdc++-v3/include/bits/allocator.h
libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc
libstdc++-v3/testsuite/20_util/allocator/void.cc
libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc
libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc

index ebb487a3ffeb2a8f820cd6488f06389400b1873d..ce678480571c7064a8e59ff880d80d80fbc26e9e 100644 (file)
@@ -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
index 49d99e52415bf1ea2380d7ad65b5c343150b703b..1572f8912467755b6ce266f32a041719fff51ad1 100644 (file)
@@ -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
index 04cd2094776a02d7a69d27bbf167f11dd53b4c25..799774861f5607d3062550e11d19a8f478d5ac35 100644 (file)
@@ -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>(),
index 88d99fe682fda08696e61d30531878e0240b270b..fad45e0fb170f26faf4a61d88c6fc2e35d1d6235 100644 (file)
@@ -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
index fa78676b30019f7473e514821ffbd5729611b172..713223bd6f277dde5783ad255f84ba74dccf1e22 100644 (file)
@@ -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