public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/100667] [11/12/13/14 Regression] std::tuple<A&&> cannot be constructed from A&&, if A not defined (only forward declared)
Date: Wed, 27 Mar 2024 17:44:37 +0000	[thread overview]
Message-ID: <bug-100667-4-0ioMLxthgz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100667-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100667

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #8)
> But I think it would be best to fix it in the compiler, so that we always
> allow directly binding T&& or const T& to T, even if T is incomplete.
> Otherwise we'll be playing whackamole all over the library.

Actually the workarounds would only be needed in <type_traits>:

--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1187,6 +1187,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        "template argument must be a complete class or an unbounded array");
     };

+  template<typename _Tp, typename _Up>
+    struct is_nothrow_constructible<_Tp&, _Up>
+    : __is_nothrow_constructible_impl<_Tp&, __add_rval_ref_t<_Up>>
+    { };
+
+  template<typename _Tp, typename _Up>
+    struct is_nothrow_constructible<_Tp&&, _Up>
+    : __is_nothrow_constructible_impl<_Tp&&, __add_rval_ref_t<_Up>>
+    { };
+
   /// is_nothrow_default_constructible
   template<typename _Tp>
     struct is_nothrow_default_constructible
@@ -1496,7 +1506,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
   template<typename _From, typename _To>
     struct is_convertible
-    : public __bool_constant<__is_convertible(_From, _To)>
+    : public __bool_constant<__is_convertible(__add_rval_ref_t<_From>, _To)>
     { };
 #else
   template<typename _From, typename _To,
@@ -1547,7 +1557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_nothrow_convertible_v
   template<typename _From, typename _To>
     inline constexpr bool is_nothrow_convertible_v
-      = __is_nothrow_convertible(_From, _To);
+      = __is_nothrow_convertible(__add_rval_ref_t<_From>, _To);

   /// is_nothrow_convertible
   template<typename _From, typename _To>



I think this should be OK but I haven't tested it yet.

  parent reply	other threads:[~2024-03-27 17:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19  8:00 [Bug libstdc++/100667] New: " piotrwn1 at gmail dot com
2021-05-19  9:09 ` [Bug libstdc++/100667] [11/12 Regression] " redi at gcc dot gnu.org
2021-06-18  7:56 ` ostash at ostash dot kiev.ua
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` [Bug libstdc++/100667] [11/12/13/14 " jakub at gcc dot gnu.org
2023-05-29 11:16 ` piotrwn1 at gmail dot com
2024-03-27 12:59 ` redi at gcc dot gnu.org
2024-03-27 13:36 ` redi at gcc dot gnu.org
2024-03-27 14:02 ` redi at gcc dot gnu.org
2024-03-27 14:03 ` redi at gcc dot gnu.org
2024-03-27 14:14 ` redi at gcc dot gnu.org
2024-03-27 17:44 ` redi at gcc dot gnu.org [this message]
2024-03-28 18:26 ` cvs-commit at gcc dot gnu.org
2024-03-28 22:33 ` [Bug libstdc++/100667] [11/12/13 " redi at gcc dot gnu.org
2024-05-01 20:31 ` cvs-commit at gcc dot gnu.org

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=bug-100667-4-0ioMLxthgz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).