public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* (no subject)
@ 2023-08-05 15:57 xeon khjj
  0 siblings, 0 replies; only message in thread
From: xeon khjj @ 2023-08-05 15:57 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

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(-)

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
-- 
2.41.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-05 15:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-05 15:57 xeon khjj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).