Message ID CAN3w5K-qLb7GkxqHjvJhYGZLM2wBJ8Pmv5eu6f83c5aOue3rdA@mail.gmail.com
State Not Applicable
Headers
Series |

Checks

Context Check Description
snail/gcc-patch-check fail Git am fail log

Commit Message

xeon khjj Aug. 5, 2023, 3:57 p.m. UTC
  From 104178c3912314f41a61a316e7c3bc0487ea8f3c Mon Sep 17 00:00:00 2001
From: K1ZeKaTo <a9618994633@gmail.com>
Date: Sat, 5 Aug 2023 14:50:19 +0000
Subject: [PATCH] Make the rvalue work fine.

It seems not considering the rvalue in the last version.

---
 libstdc++-v3/include/bits/iterator_concepts.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Patch

diff --git a/libstdc++-v3/include/bits/iterator_concepts.h
b/libstdc++-v3/include/bits/iterator_concepts.h
index e32e94dc9fc..8bb7c0fb8c0 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -86,14 +86,14 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       concept __can_reference = requires { typename __with_ref<_Tp>; };

     template<typename _Tp>
-      concept __dereferenceable = requires(_Tp& __t)
+      concept __dereferenceable = requires(_Tp&& __t)
    {
-     { *__t } -> __can_reference;
+     { *static_cast<_Tp&&>(__t) } -> __can_reference;
    };
   } // namespace __detail

   template<__detail::__dereferenceable _Tp>
-    using iter_reference_t = decltype(*std::declval<_Tp&>());
+    using iter_reference_t = decltype(*std::declval<_Tp&&>());

   namespace ranges
   {
@@ -116,7 +116,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    template<typename _Tp>
      requires __adl_imove<_Tp>
      struct __result<_Tp>
-     { using type = decltype(iter_move(std::declval<_Tp>())); };
+     { using type = decltype(iter_move(std::declval<_Tp&&>())); };

    template<typename _Tp>
      requires (!__adl_imove<_Tp>)
@@ -129,9 +129,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
      _S_noexcept()
      {
        if constexpr (__adl_imove<_Tp>)
-         return noexcept(iter_move(std::declval<_Tp>()));
+         return noexcept(iter_move(std::declval<_Tp&&>()));
        else
-         return noexcept(*std::declval<_Tp>());
+         return noexcept(*std::declval<_Tp&&>());
      }

       public:
@@ -148,9 +148,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
        if constexpr (__adl_imove<_Tp>)
          return iter_move(static_cast<_Tp&&>(__e));
        else if constexpr (is_lvalue_reference_v<iter_reference_t<_Tp>>)
-         return static_cast<__type<_Tp>>(*__e);
+         return static_cast<__type<_Tp>>(*static_cast<_Tp&&>(__e));
        else
-         return *__e;
+         return *static_cast<_Tp&&>(__e);
      }
       };
     } // namespace __cust_imove