Tested x86_64-linux.

-- >8 --

The P2278R4 additions for C++23 are currently guarded by a check for
__cplusplus > 202002L but can use __glibcxx_ranges_as_const instead.

libstdc++-v3/ChangeLog:

        * include/bits/ranges_base.h (const_iterator_t): Change
        preprocessor condition to use __glibcxx_ranges_as_const.
        (const_sentinel_t, range_const_reference_t): Likewise.
        (__access::__possibly_const_range, cbegin, cend, crbegin)
        (crend, cdata): Likewise.
        * include/bits/stl_iterator.h (iter_const_reference_t)
        (basic_const_iterator, const_iterator, const_sentinel)
        (make_const_iterator): Likewise.
---
 libstdc++-v3/include/bits/ranges_base.h  | 16 ++++++++--------
 libstdc++-v3/include/bits/stl_iterator.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/include/bits/ranges_base.h 
b/libstdc++-v3/include/bits/ranges_base.h
index 6597ffa532d..23c0b56ff22 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -513,7 +513,7 @@ namespace ranges
   template<range _Range>
     using sentinel_t = decltype(ranges::end(std::declval<_Range&>()));
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
   template<range _Range>
     using const_iterator_t = const_iterator<iterator_t<_Range>>;
 
@@ -616,7 +616,7 @@ namespace ranges
     concept common_range
       = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
 
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
   template<typename _Tp>
     concept constant_range
       = input_range<_Tp> && 
std::__detail::__constant_iterator<iterator_t<_Tp>>;
@@ -624,7 +624,7 @@ namespace ranges
 
   namespace __access
   {
-#if __cplusplus > 202020L
+#if __glibcxx_ranges_as_const // >= C++23
     template<typename _Range>
       constexpr auto&
       __possibly_const_range(_Range& __r) noexcept
@@ -651,7 +651,7 @@ namespace ranges
 
     struct _CBegin
     {
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
       template<__maybe_borrowed_range _Tp>
        [[nodiscard]]
        constexpr auto
@@ -679,7 +679,7 @@ namespace ranges
 
     struct _CEnd final
     {
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
       template<__maybe_borrowed_range _Tp>
        [[nodiscard]]
        constexpr auto
@@ -707,7 +707,7 @@ namespace ranges
 
     struct _CRBegin
     {
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
       template<__maybe_borrowed_range _Tp>
        [[nodiscard]]
        constexpr auto
@@ -735,7 +735,7 @@ namespace ranges
 
     struct _CREnd
     {
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
       template<__maybe_borrowed_range _Tp>
        [[nodiscard]]
        constexpr auto
@@ -763,7 +763,7 @@ namespace ranges
 
     struct _CData
     {
-#if __cplusplus > 202002L
+#if __glibcxx_ranges_as_const // >= C++23
       template<__maybe_borrowed_range _Tp>
        [[nodiscard]]
        constexpr const auto*
diff --git a/libstdc++-v3/include/bits/stl_iterator.h 
b/libstdc++-v3/include/bits/stl_iterator.h
index 560a10a7abe..d3823057270 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -2571,7 +2571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                                      void>;
     };
 
-#if __cplusplus > 202020L
+#if __glibcxx_ranges_as_const // >= C++23
   template<indirectly_readable _It>
     using iter_const_reference_t
       = common_reference_t<const iter_value_t<_It>&&, iter_reference_t<_It>>;
-- 
2.45.1

Reply via email to