[committed] libstdc++: Implement LWG issues 3320, 3369, 3200, 3348, 3237

Message ID 20200219154516.GO9441@redhat.com
State New
Headers show
Series
  • [committed] libstdc++: Implement LWG issues 3320, 3369, 3200, 3348, 3237
Related show

Commit Message

Jonathan Wakely Feb. 19, 2020, 3:45 p.m.
make polymorphic_allocator throw consistent type (LWG 3237)
Add __cpp_lib_unwrap_ref feature test macro
midpoint should not constrain T is complete (LWG 3200)
span's deduction-guide for built-in arrays doesn't work (LWG 3369)
Remove std::span::cbegin and std::span::cend (LWG 3320)

Tested powerpc64le-linux, committed to master.

Patch

commit e89100ef2efcf2bb1f1af1bdd81a1035d78f3fa4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 19 15:21:31 2020 +0000

    libstdc++: make polymorphic_allocator throw consistent type (LWG 3237)
    
            * include/std/memory_resource (polymorphic_allocator::allocate)
            (polymorphic_allocator::allocate_object): Change type of exception to
            bad_array_new_length (LWG 3237).
            * testsuite/20_util/polymorphic_allocator/lwg3237.cc: New test.

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bc4ce773f1e..067cf8343f6 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@ 
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+	* include/std/memory_resource (polymorphic_allocator::allocate)
+	(polymorphic_allocator::allocate_object): Change type of exception to
+	bad_array_new_length (LWG 3237).
+	* testsuite/20_util/polymorphic_allocator/lwg3237.cc: New test.
+
 	* include/std/type_traits (__cpp_lib_unwrap_ref): Define (LWG 3348).
 	* include/std/version (__cpp_lib_unwrap_ref): Likewise.
 	* testsuite/20_util/unwrap_reference/1.cc: Check macro.
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index 73f77bdcadf..74683c5267f 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -167,7 +167,7 @@  namespace pmr
       __attribute__((__returns_nonnull__))
       {
 	if (__n > (__detail::__int_limits<size_t>::max() / sizeof(_Tp)))
-	  std::__throw_bad_alloc();
+	  _GLIBCXX_THROW_OR_ABORT(bad_array_new_length());
 	return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp),
 						       alignof(_Tp)));
       }
@@ -193,7 +193,7 @@  namespace pmr
 	allocate_object(size_t __n = 1)
 	{
 	  if ((__detail::__int_limits<size_t>::max() / sizeof(_Up)) < __n)
-	    __throw_length_error("polymorphic_allocator::allocate_object");
+	    _GLIBCXX_THROW_OR_ABORT(bad_array_new_length());
 	  return static_cast<_Up*>(allocate_bytes(__n * sizeof(_Up),
 						  alignof(_Up)));
 	}
diff --git a/libstdc++-v3/testsuite/20_util/polymorphic_allocator/lwg3237.cc b/libstdc++-v3/testsuite/20_util/polymorphic_allocator/lwg3237.cc
new file mode 100644
index 00000000000..350f5ac9c95
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/polymorphic_allocator/lwg3237.cc
@@ -0,0 +1,55 @@ 
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do run { target c++2a } }
+
+#include <memory_resource>
+#include <testsuite_hooks.h>
+
+struct large { alignas(1024) int i; };
+
+void
+test01()
+{
+  std::pmr::polymorphic_allocator<large> a;
+  large* p = nullptr;
+  try
+  {
+    p = a.allocate(std::size_t(-1) / 256);
+    VERIFY( false );
+  }
+  catch (const std::bad_array_new_length&)
+  {
+  }
+
+  std::pmr::polymorphic_allocator<int> a2;
+  try
+  {
+    p = a2.allocate_object<large>(std::size_t(-1) / 256);
+    VERIFY( false );
+  }
+  catch (const std::bad_array_new_length&)
+  {
+  }
+}
+
+int
+main()
+{
+  test01();
+}

commit bb54e0b8794dfeea1f59ed9ca6433df1eccb85e9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 19 15:06:24 2020 +0000

    libstdc++: Add __cpp_lib_unwrap_ref feature test macro
    
    We already defined the traits in <type_traits> as now required by LWG
    3348, but the macro was missing. This adds it.
    
            * include/std/type_traits (__cpp_lib_unwrap_ref): Define (LWG 3348).
            * include/std/version (__cpp_lib_unwrap_ref): Likewise.
            * testsuite/20_util/unwrap_reference/1.cc: Check macro.
            * testsuite/20_util/unwrap_reference/3.cc: New test.

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 84e5ea98022..bc4ce773f1e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@ 
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+	* include/std/type_traits (__cpp_lib_unwrap_ref): Define (LWG 3348).
+	* include/std/version (__cpp_lib_unwrap_ref): Likewise.
+	* testsuite/20_util/unwrap_reference/1.cc: Check macro.
+	* testsuite/20_util/unwrap_reference/3.cc: New test.
+
 	* include/std/numeric (midpoint(T8, T*)): Do not check for complete
 	type during overload resolution, use static assert instead (LWG 3200).
 	* testsuite/26_numerics/midpoint/pointer.cc: Do not test with
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 684a792d02c..14aa2b37a4f 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3242,6 +3242,8 @@  template <typename _From, typename _To>
   template<typename _Tp>
     using type_identity_t = typename type_identity<_Tp>::type;
 
+#define __cpp_lib_unwrap_ref 201811L
+
   /// Unwrap a reference_wrapper
   template<typename _Tp>
     struct unwrap_reference { using type = _Tp; };
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index b36b999cb31..e2ccf619d4a 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -178,6 +178,7 @@ 
 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
 # define __cpp_lib_is_constant_evaluated 201811L
 #endif
+#define __cpp_lib_unwrap_ref 201811L
 
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_bind_front 201907L
diff --git a/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc b/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc
index 3a663433911..3496204e4d2 100644
--- a/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc
+++ b/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc
@@ -20,6 +20,12 @@ 
 
 #include <type_traits>
 
+#ifndef __cpp_lib_unwrap_ref
+# error "Feature-test macro for unwrap_reference missing in <type_traits>"
+#elif __cpp_lib_unwrap_ref != 201811L
+# error "Feature-test macro for unwrap_reference has wrong value in <type_traits>"
+#endif
+
 template<typename T, typename U> struct expect_same;
 template<typename T> struct expect_same<T, T> : std::true_type { };
 
diff --git a/libstdc++-v3/testsuite/20_util/unwrap_reference/3.cc b/libstdc++-v3/testsuite/20_util/unwrap_reference/3.cc
new file mode 100644
index 00000000000..3ea9cd18a05
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unwrap_reference/3.cc
@@ -0,0 +1,27 @@ 
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <version>
+
+#ifndef __cpp_lib_unwrap_ref
+# error "Feature-test macro for unwrap_reference missing in <version>"
+#elif __cpp_lib_unwrap_ref != 201811L
+# error "Feature-test macro for unwrap_reference has wrong value in <version>"
+#endif

commit 5f031f9747fdfb04213c20d24f109fb5ffc877df
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 19 15:01:41 2020 +0000

    libstdc++: midpoint should not constrain T is complete (LWG 3200)
    
            * include/std/numeric (midpoint(T8, T*)): Do not check for complete
            type during overload resolution, use static assert instead (LWG 3200).
            * testsuite/26_numerics/midpoint/pointer.cc: Do not test with
            incomplete type.
            * testsuite/26_numerics/midpoint/pointer_neg.cc: New test.

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 18085f3d9bd..84e5ea98022 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@ 
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+	* include/std/numeric (midpoint(T8, T*)): Do not check for complete
+	type during overload resolution, use static assert instead (LWG 3200).
+	* testsuite/26_numerics/midpoint/pointer.cc: Do not test with
+	incomplete type.
+	* testsuite/26_numerics/midpoint/pointer_neg.cc: New test.
+
 	* include/std/span (span(T (&)[N])): Use non-deduced context to
 	prevent first parameter from interfering with class template argument
 	deduction (LWG 3369).
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 0b0a8ff8a61..cf35191cb47 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -208,10 +208,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _Tp>
-    constexpr
-    enable_if_t<__and_v<is_object<_Tp>, bool_constant<sizeof(_Tp) != 0>>, _Tp*>
+    constexpr enable_if_t<is_object_v<_Tp>, _Tp*>
     midpoint(_Tp* __a, _Tp* __b) noexcept
     {
+      static_assert( sizeof(_Tp) != 0, "type must be complete" );
       return __a  + (__b - __a) / 2;
     }
 _GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/testsuite/26_numerics/midpoint/pointer.cc b/libstdc++-v3/testsuite/26_numerics/midpoint/pointer.cc
index e0b75c92739..7e75d50663c 100644
--- a/libstdc++-v3/testsuite/26_numerics/midpoint/pointer.cc
+++ b/libstdc++-v3/testsuite/26_numerics/midpoint/pointer.cc
@@ -19,7 +19,6 @@ 
 // { dg-do run { target c++2a } }
 
 #include <numeric>
-#include <climits>
 #include <testsuite_hooks.h>
 
 const int* p = nullptr;
@@ -36,7 +35,6 @@  template<typename T> constexpr bool no_midpoint()
 static_assert(no_midpoint<void>());
 static_assert(no_midpoint<int()>());
 static_assert(no_midpoint<int&>());
-static_assert(no_midpoint<struct Incomplete>());
 
 constexpr int ca[3] = {};
 static_assert( std::midpoint(ca, ca+3) == ca+1 );
diff --git a/libstdc++-v3/testsuite/26_numerics/midpoint/pointer_neg.cc b/libstdc++-v3/testsuite/26_numerics/midpoint/pointer_neg.cc
new file mode 100644
index 00000000000..564b1acfe27
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/midpoint/pointer_neg.cc
@@ -0,0 +1,27 @@ 
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <numeric>
+
+// LWG 3200. midpoint should not constrain T is complete
+struct Incomplete* pinc = 0;
+auto p1 = std::midpoint(pinc, pinc); // { dg-error "here" }
+
+// { dg-error "incomplete type" "" { target *-*-* } 0 }

commit 66ae31eb308e5bc90ce6dfd0a67381a0929a6aa0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 19 14:41:46 2020 +0000

    libstdc++: span's deduction-guide for built-in arrays doesn't work (LWG 3369)
    
    The 23_containers/span/deduction.cc test was already passing, but only
    because I had previously implemented the original proposed resolution of
    3255. As pointed out in 3255 that original P/R was incorrect because it
    broke construction from array xvalues. This reverts the incorrect part
    of 3255 (and adds tests for the case it broke), and implements the
    resolution of 3369 instead.
    
            * include/std/span (span(T (&)[N])): Use non-deduced context to
            prevent first parameter from interfering with class template argument
            deduction (LWG 3369).
            * testsuite/23_containers/span/deduction.cc: Add missing 'const'.
            * testsuite/23_containers/span/lwg3255.cc: Check for construction from
            rvalues.

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f5f8b6fd500..18085f3d9bd 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,12 @@ 
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+	* include/std/span (span(T (&)[N])): Use non-deduced context to
+	prevent first parameter from interfering with class template argument
+	deduction (LWG 3369).
+	* testsuite/23_containers/span/deduction.cc: Add missing 'const'.
+	* testsuite/23_containers/span/lwg3255.cc: Check for construction from
+	rvalues.
+
 	* include/std/span (span::const_iterator, span::const_reverse_iterator)
 	(span::cbegin(), span::cend(), span::crbegin(), span::crend()):
 	Remove (LWG 3320).
diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
index ccfd7db39fe..16b09a1e50c 100644
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -182,10 +182,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    }
 	}
 
-      template<typename _Tp, size_t _ArrayExtent>
-	requires __is_compatible_array<_Tp, _ArrayExtent>::value
+      template<size_t _ArrayExtent>
+	requires (_Extent == dynamic_extent || _ArrayExtent == _Extent)
 	constexpr
-	span(_Tp (&__arr)[_ArrayExtent]) noexcept
+	span(type_identity_t<element_type> (&__arr)[_ArrayExtent]) noexcept
 	: span(static_cast<pointer>(__arr), _ArrayExtent)
 	{ }
 
diff --git a/libstdc++-v3/testsuite/23_containers/span/deduction.cc b/libstdc++-v3/testsuite/23_containers/span/deduction.cc
index 66e955e961b..2fe1ac477c8 100644
--- a/libstdc++-v3/testsuite/23_containers/span/deduction.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/deduction.cc
@@ -73,7 +73,7 @@  test01()
   std::span s9(s2);
   static_assert( is_static_span<int, 2>(s9) );
 
-  std::span s10(const_cast<std::span<int, 2>&>(s2));
+  std::span s10(const_cast<const std::span<int, 2>&>(s2));
   static_assert( is_static_span<int, 2>(s10) );
 
   std::span s11(s5);
diff --git a/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc b/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc
index 91edf6a04fd..03ced2c8710 100644
--- a/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc
@@ -57,10 +57,14 @@  static_assert( !is_constructible_v<span<const int, 1>, const array<const int, 2>
 static_assert( is_constructible_v<span<int>, int(&)[2]> );
 static_assert( is_constructible_v<span<const int>, int(&)[2]> );
 static_assert( is_constructible_v<span<const int>, const int(&)[2]> );
+static_assert( is_constructible_v<span<const int>, int[2]> );
+static_assert( is_constructible_v<span<const int>, const int[2]> );
 
 static_assert( is_constructible_v<span<int>, array<int, 2>&> );
 static_assert( is_constructible_v<span<const int>, array<int, 2>&> );
 static_assert( is_constructible_v<span<const int>, array<const int, 2>&> );
+static_assert( is_constructible_v<span<const int>, array<int, 2>> );
+static_assert( is_constructible_v<span<const int>, array<const int, 2>> );
 
 static_assert( is_constructible_v<span<const int>, const array<int, 2>&> );
 static_assert( is_constructible_v<span<const int>, const array<const int, 2>&> );

commit 247f410b83797a1840573840cc2a539ef9d7f96b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 19 14:00:59 2020 +0000

    libstdc++: Remove std::span::cbegin and std::span::cend (LWG 3320)
    
            * include/std/span (span::const_iterator, span::const_reverse_iterator)
            (span::cbegin(), span::cend(), span::crbegin(), span::crend()):
            Remove (LWG 3320).
            * testsuite/23_containers/span/everything.cc: Replace uses of cbegin
            and cend.
            * testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
            Likewise.
            * testsuite/20_util/specialized_algorithms/uninitialized_copy/
            constrained.cc: Likewise.
            * testsuite/20_util/specialized_algorithms/
            uninitialized_default_construct/constrained.cc: Likewise.
            * testsuite/20_util/specialized_algorithms/uninitialized_fill/
            constrained.cc: Likewise.
            * testsuite/20_util/specialized_algorithms/uninitialized_move/
            constrained.cc: Likewise.
            * testsuite/20_util/specialized_algorithms/
            uninitialized_value_construct/constrained.cc: Likewise.

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f01b78da118..f5f8b6fd500 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,23 @@ 
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+	* include/std/span (span::const_iterator, span::const_reverse_iterator)
+	(span::cbegin(), span::cend(), span::crbegin(), span::crend()):
+	Remove (LWG 3320).
+	* testsuite/23_containers/span/everything.cc: Replace uses of cbegin
+	and cend.
+	* testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
+	Likewise.
+	* testsuite/20_util/specialized_algorithms/uninitialized_copy/
+	constrained.cc: Likewise.
+	* testsuite/20_util/specialized_algorithms/
+	uninitialized_default_construct/constrained.cc: Likewise.
+	* testsuite/20_util/specialized_algorithms/uninitialized_fill/
+	constrained.cc: Likewise.
+	* testsuite/20_util/specialized_algorithms/uninitialized_move/
+	constrained.cc: Likewise.
+	* testsuite/20_util/specialized_algorithms/
+	uninitialized_value_construct/constrained.cc: Likewise.
+
 	* include/bits/range_access.h (range_size_t): Define alias template.
 	* include/std/ranges (all_view): Rename to views::all_t (LWG 3335).
 	* testsuite/std/ranges/adaptors/filter.cc: Adjust to new name.
diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
index 63dc2515b25..ccfd7db39fe 100644
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -141,9 +141,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using reference              = element_type&;
       using const_reference        = const element_type&;
       using iterator = __gnu_cxx::__normal_iterator<pointer, span>;
-      using const_iterator = __gnu_cxx::__normal_iterator<const_pointer, span>;
       using reverse_iterator       = std::reverse_iterator<iterator>;
-      using const_reverse_iterator = std::reverse_iterator<const_iterator>;
 
       // member constants
       static constexpr size_t extent = _Extent;
@@ -297,34 +295,18 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       begin() const noexcept
       { return iterator(this->_M_ptr); }
 
-      constexpr const_iterator
-      cbegin() const noexcept
-      { return const_iterator(this->_M_ptr); }
-
       constexpr iterator
       end() const noexcept
       { return iterator(this->_M_ptr + this->size()); }
 
-      constexpr const_iterator
-      cend() const noexcept
-      { return const_iterator(this->_M_ptr + this->size()); }
-
       constexpr reverse_iterator
       rbegin() const noexcept
       { return reverse_iterator(this->end()); }
 
-      constexpr const_reverse_iterator
-      crbegin() const noexcept
-      { return const_reverse_iterator(this->cend()); }
-
       constexpr reverse_iterator
       rend() const noexcept
       { return reverse_iterator(this->begin()); }
 
-      constexpr const_reverse_iterator
-      crend() const noexcept
-      { return const_reverse_iterator(this->cbegin()); }
-
       // subviews
 
       template<size_t _Count>
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/constrained.cc
index 730625d9a21..c04049de0b5 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/constrained.cc
@@ -54,7 +54,7 @@  test01()
       ranges::uninitialized_default_construct(rx);
       VERIFY( X::count == size );
 
-      auto i = rx.cbegin();
+      auto i = rx.begin();
       if (k == 0)
 	i = ranges::destroy(rx);
       else if (k == 1)
@@ -64,7 +64,7 @@  test01()
       else
 	__builtin_abort();
 
-      VERIFY( i == rx.cend() );
+      VERIFY( i == rx.end() );
       VERIFY( X::count == 0 );
     }
 }
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc
index 948406432cb..c1a50c45df9 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc
@@ -47,7 +47,7 @@  test01(const std::vector<T> &ix)
       auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
       std::span<T> rx((T *)buffer.get(), size);
 
-      ranges::uninitialized_copy_result res = {ix.cbegin(), rx.cbegin()};
+      ranges::uninitialized_copy_result res = {ix.begin(), rx.begin()};
       if (k == 0)
 	res = ranges::uninitialized_copy(ix.begin(), ix.end(),
 					 rx.begin(), rx.end());
@@ -58,33 +58,33 @@  test01(const std::vector<T> &ix)
 					   rx.begin(), rx.end());
       else if (k == 3)
 	res = ranges::uninitialized_copy(ix.begin(), ix.end(),
-					 rx.cbegin(), rx.cend());
+					 rx.begin(), rx.end());
       else if (k == 4)
 	res = ranges::uninitialized_copy(ix, std::as_const(rx));
       else if (k == 5)
 	res = ranges::uninitialized_copy_n(ix.begin(), size,
-					   rx.cbegin(), rx.cend());
+					   rx.begin(), rx.end());
       else if (k == 6)
 	res = ranges::uninitialized_copy_n(ix.begin(), size/2,
-					   rx.cbegin(), rx.cend());
+					   rx.begin(), rx.end());
       else if (k == 7)
 	res = ranges::uninitialized_copy_n(ix.begin(), size,
-					   rx.cbegin(), rx.cbegin()+size/2);
+					   rx.begin(), rx.begin()+size/2);
       else
 	__builtin_abort();
 
       if (k == 6 || k == 7)
 	{
-	  VERIFY( ranges::distance(ix.cbegin(), res.in) == size/2 );
-	  VERIFY( ranges::distance(rx.cbegin(), res.out) == size/2 );
+	  VERIFY( ranges::distance(ix.begin(), res.in) == size/2 );
+	  VERIFY( ranges::distance(rx.begin(), res.out) == size/2 );
 	  VERIFY( ranges::equal(ix.begin(), ix.begin()+size/2,
 				rx.begin(), rx.begin()+size/2) );
 	  ranges::destroy(rx.begin(), rx.begin()+size/2);
 	}
       else
 	{
-	  VERIFY( res.in == ix.cend() );
-	  VERIFY( res.out == rx.cend() );
+	  VERIFY( res.in == ix.end() );
+	  VERIFY( res.out == rx.end() );
 	  VERIFY( ranges::equal(ix, rx) );
 	  ranges::destroy(rx);
 	}
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc
index 6ef24cc7ea0..d6ccfc7c7e4 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc
@@ -53,7 +53,7 @@  test01()
 	  ranges::fill(rx, t);
 	}
 
-      auto i = rx.cbegin();
+      auto i = rx.begin();
       if (k == 0)
 	i = ranges::uninitialized_default_construct(rx.begin(), rx.end());
       else if (k == 1)
@@ -63,15 +63,15 @@  test01()
       else if constexpr (std::is_fundamental_v<T>)
 	continue;
       else if (k == 3)
-	i = ranges::uninitialized_default_construct(rx.cbegin(), rx.cend());
+	i = ranges::uninitialized_default_construct(rx.begin(), rx.end());
       else if (k == 4)
 	i = ranges::uninitialized_default_construct(std::as_const(rx));
       else if (k == 5)
-	i = ranges::uninitialized_default_construct_n(rx.cbegin(), 1024);
+	i = ranges::uninitialized_default_construct_n(rx.begin(), 1024);
       else
 	__builtin_abort();
 
-      VERIFY( i == rx.cend() );
+      VERIFY( i == rx.end() );
       VERIFY( ranges::find_if(rx, [&t](const T& v) { return t != v; }) == i );
 
       ranges::destroy(rx);
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constrained.cc
index c95fd666942..0fbbd1fa49f 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/constrained.cc
@@ -45,7 +45,7 @@  test01(const T& value)
       auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
       std::span<T> rx((T *)buffer.get(), size);
 
-      auto i = rx.cbegin();
+      auto i = rx.begin();
       if (k == 0)
 	i = ranges::uninitialized_fill(rx.begin(), rx.end(), value);
       else if (k == 1)
@@ -53,15 +53,15 @@  test01(const T& value)
       else if (k == 2)
 	i = ranges::uninitialized_fill_n(rx.begin(), 1024, value);
       else if (k == 3)
-	i = ranges::uninitialized_fill(rx.cbegin(), rx.cend(), value);
+	i = ranges::uninitialized_fill(rx.begin(), rx.end(), value);
       else if (k == 4)
 	i = ranges::uninitialized_fill(std::as_const(rx), value);
       else if (k == 5)
-	i = ranges::uninitialized_fill_n(rx.cbegin(), 1024, value);
+	i = ranges::uninitialized_fill_n(rx.begin(), 1024, value);
       else
 	__builtin_abort();
 
-      VERIFY( i == rx.cend() );
+      VERIFY( i == rx.end() );
       VERIFY( ranges::find_if(rx, [&value](const T& v) { return value != v; }) == i );
 
       ranges::destroy(rx);
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc
index 796c7ca8f46..a7d6fd39b38 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc
@@ -51,7 +51,7 @@  test01(std::vector<T> ix)
       auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
       std::span<T> rx((T *)buffer.get(), size);
 
-      ranges::uninitialized_move_result res = {ix.cbegin(), rx.cbegin()};
+      ranges::uninitialized_move_result res = {ix.begin(), rx.begin()};
       if (k == 0)
 	res = ranges::uninitialized_move(ix.begin(), ix.end(),
 					 rx.begin(), rx.end());
@@ -62,33 +62,33 @@  test01(std::vector<T> ix)
 					   rx.begin(), rx.end());
       else if (k == 3)
 	res = ranges::uninitialized_move(ix.begin(), ix.end(),
-					 rx.cbegin(), rx.cend());
+					 rx.begin(), rx.end());
       else if (k == 4)
 	res = ranges::uninitialized_move(ix, std::as_const(rx));
       else if (k == 5)
 	res = ranges::uninitialized_move_n(ix.begin(), size,
-					   rx.cbegin(), rx.cend());
+					   rx.begin(), rx.end());
       else if (k == 6)
 	res = ranges::uninitialized_move_n(ix.begin(), size/2,
-					   rx.cbegin(), rx.cend());
+					   rx.begin(), rx.end());
       else if (k == 7)
 	res = ranges::uninitialized_move_n(ix.begin(), size,
-					   rx.cbegin(), rx.cbegin()+size/2);
+					   rx.begin(), rx.begin()+size/2);
       else
 	__builtin_abort();
 
       if (k == 6 || k == 7)
 	{
-	  VERIFY( ranges::distance(ix.cbegin(), res.in) == size/2 );
-	  VERIFY( ranges::distance(rx.cbegin(), res.out) == size/2 );
+	  VERIFY( ranges::distance(ix.begin(), res.in) == size/2 );
+	  VERIFY( ranges::distance(rx.begin(), res.out) == size/2 );
 	  VERIFY( ranges::equal(saved_ix.begin(), saved_ix.begin()+size/2,
 				rx.begin(), rx.begin()+size/2) );
 	  ranges::destroy(rx.begin(), rx.begin()+size/2);
 	}
       else
 	{
-	  VERIFY( res.in == ix.cend() );
-	  VERIFY( res.out == rx.cend() );
+	  VERIFY( res.in == ix.end() );
+	  VERIFY( res.out == rx.end() );
 	  VERIFY( ranges::equal(saved_ix, rx) );
 	  ranges::destroy(rx);
 	}
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc
index 5928bc04c70..ba3799b103e 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc
@@ -48,7 +48,7 @@  test01()
 
       T t{};
 
-      auto i = rx.cbegin();
+      auto i = rx.begin();
       if (k == 0)
 	i = ranges::uninitialized_value_construct(rx.begin(), rx.end());
       else if (k == 1)
@@ -56,15 +56,15 @@  test01()
       else if (k == 2)
 	i = ranges::uninitialized_value_construct_n(rx.begin(), 1024);
       else if (k == 3)
-	i = ranges::uninitialized_value_construct(rx.cbegin(), rx.cend());
+	i = ranges::uninitialized_value_construct(rx.begin(), rx.end());
       else if (k == 4)
 	i = ranges::uninitialized_value_construct(std::as_const(rx));
       else if (k == 5)
-	i = ranges::uninitialized_value_construct_n(rx.cbegin(), 1024);
+	i = ranges::uninitialized_value_construct_n(rx.begin(), 1024);
       else
 	__builtin_abort();
 
-      VERIFY( i == rx.cend() );
+      VERIFY( i == rx.end() );
       VERIFY( ranges::find_if(rx, [&t](const T& v) { return t != v; }) == i );
 
       ranges::destroy(rx);
diff --git a/libstdc++-v3/testsuite/23_containers/span/everything.cc b/libstdc++-v3/testsuite/23_containers/span/everything.cc
index 0cca06fa4fe..0ae4d741d0e 100644
--- a/libstdc++-v3/testsuite/23_containers/span/everything.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/everything.cc
@@ -162,9 +162,8 @@  main()
   bool really_empty1 = std::empty(shorts);
   bool really_empty2 = shorts.data() == nullptr;
   bool really_empty3 = shorts.begin() == shorts.end();
-  bool really_empty4 = shorts.cbegin() == shorts.cend();
   bool really_empty =
-    really_empty0 && really_empty1 && really_empty2 && really_empty3 && really_empty4;
+    really_empty0 && really_empty1 && really_empty2 && really_empty3;
   (void)really_empty;
   VERIFY(really_empty);
 
@@ -179,10 +178,10 @@  main()
   std::span<const std::byte> muh_byte_span   = std::as_bytes(muh_span);
   std::span<std::byte> muh_mutable_byte_span = std::as_writable_bytes(muh_span);
   std::span<std::byte> muh_original_byte_span(original_bytes, original_bytes + 4);
-  bool definitely_reinterpret_casted0 = std::equal(muh_byte_span.cbegin(), muh_byte_span.cend(),
-    muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
-  bool definitely_reinterpret_casted1 = std::equal(muh_mutable_byte_span.cbegin(),
-    muh_mutable_byte_span.cend(), muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
+  bool definitely_reinterpret_casted0 = std::equal(muh_byte_span.begin(), muh_byte_span.end(),
+    muh_original_byte_span.begin(), muh_original_byte_span.end());
+  bool definitely_reinterpret_casted1 = std::equal(muh_mutable_byte_span.begin(),
+    muh_mutable_byte_span.end(), muh_original_byte_span.begin(), muh_original_byte_span.end());
   bool definitely_reinterpret_casted =
     definitely_reinterpret_casted0 && definitely_reinterpret_casted1;
   (void)definitely_reinterpret_casted;
@@ -190,8 +189,8 @@  main()
 
   std::span<std::byte> muh_original_byte_span_ptr_size(original_bytes, 4);
   bool definitely_equivalent =
-    std::equal(muh_original_byte_span_ptr_size.cbegin(), muh_original_byte_span_ptr_size.cend(),
-      muh_original_byte_span.cbegin(), muh_original_byte_span.cend());
+    std::equal(muh_original_byte_span_ptr_size.begin(), muh_original_byte_span_ptr_size.end(),
+      muh_original_byte_span.begin(), muh_original_byte_span.end());
   (void)definitely_equivalent;
   VERIFY(definitely_equivalent);