public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: xeon khjj <a9618994633@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: 
Date: Sat, 5 Aug 2023 23:57:56 +0800	[thread overview]
Message-ID: <CAN3w5K-qLb7GkxqHjvJhYGZLM2wBJ8Pmv5eu6f83c5aOue3rdA@mail.gmail.com> (raw)

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

                 reply	other threads:[~2023-08-05 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN3w5K-qLb7GkxqHjvJhYGZLM2wBJ8Pmv5eu6f83c5aOue3rdA@mail.gmail.com \
    --to=a9618994633@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).