From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA4813858D34; Wed, 27 Mar 2024 17:44:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA4813858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711561478; bh=4YUrj1hB+ZwgNUNASLJCF/iEkhUwuuBFgD2el6MYRQs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nGGBzHBPTbI6SROhiseVltt+fVQzqxAnN7G3/KH4WL7A9c3JZ9fu9Lw/+wf8RO4Rv UaV1eT4U64qddOUgDZuf/FydqfeCc23XfsPvzUqWMOEFBF+7EQONdotSvtQzunEqxz 1c/ustmws2dSp5h5IcY7uXT9PU76ErVxDCbzb13c= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100667] [11/12/13/14 Regression] std::tuple cannot be constructed from A&&, if A not defined (only forward declared) Date: Wed, 27 Mar 2024 17:44:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100667 --- Comment #11 from Jonathan Wakely --- (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 : --- 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 + struct is_nothrow_constructible<_Tp&, _Up> + : __is_nothrow_constructible_impl<_Tp&, __add_rval_ref_t<_Up>> + { }; + + template + struct is_nothrow_constructible<_Tp&&, _Up> + : __is_nothrow_constructible_impl<_Tp&&, __add_rval_ref_t<_Up>> + { }; + /// is_nothrow_default_constructible template struct is_nothrow_default_constructible @@ -1496,7 +1506,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible) template struct is_convertible - : public __bool_constant<__is_convertible(_From, _To)> + : public __bool_constant<__is_convertible(__add_rval_ref_t<_From>, _To= )> { }; #else template inline constexpr bool is_nothrow_convertible_v - =3D __is_nothrow_convertible(_From, _To); + =3D __is_nothrow_convertible(__add_rval_ref_t<_From>, _To); /// is_nothrow_convertible template I think this should be OK but I haven't tested it yet.=