From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 045D23858291; Wed, 27 Mar 2024 14:02:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 045D23858291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711548124; bh=Qdrfsqzn2AKmV1KqIl2g6xmcoG/oZaj+6CH1KHjWQHM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rX3sOdFbzc3kIQvnimD3bNODz4WKsKAkYIww2oxHwOgNFc51n0+lmUt7qdxNe027L bzM2o83gYweC0exYP5OKSbmPMwzqbiXe0zvcWEXpj0o/94ZpMv7Ptw3nGaD/N4i9P0 CuWW5wlMD0K8jyPeUtvSmHiaFT/DVDFquz7M7Xs8= 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 14:02:03 +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 #8 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #6) > (In reply to Piotr Nycz from comment #0) > > It looks that std library code start requiring this to pass: > > std::is_nothrow_constructible... >=20 > Indeed, that's what the standard requires (Clang and MSVC reject this the > same way). The standard also says that using traits like is_constructible > requires complete types. >=20 > However, that's clearly silly for is_constructible because we know > that reference binding is valid for any A whether it's complete or not. >=20 > This is the subject of: > https://cplusplus.github.io/LWG/issue2939 We can fix this in std::tuple by adding && to the source objects in all is_constructible and is_convertible conditions. Or we could fix it in the t= ype traits themselves. But I think it would be best to fix it in the compiler, so that we always a= llow directly binding T&& or const T& to T, even if T is incomplete. Otherwise w= e'll be playing whackamole all over the library.=