From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 154943861863; Mon, 19 Feb 2024 08:07:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 154943861863 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708330061; bh=ixxsMgpblfN2sDNM3SSDpyRCZWHRy9EvidndYf1CeF8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j3g7sZynDLrSkc10yksT8nJ1M+G5LWhCIhbmpwpCVSIOc/duNM3hnfhw1rA4vvo2x MRUI7z+WsPqA4aDnnqNvimwko5QpktoK+xQk1sX4rwvhbvDIlBqXQt70eF52mu5A0n rnR/y+wMNC2AdVP3bSTlfjkhv5ugtj04kW28FguM= From: "de34 at live dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113060] std::variant converting constructor/assignment is non-conforming after P2280? Date: Mon, 19 Feb 2024 08:07:38 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: de34 at live dot cn X-Bugzilla-Status: SUSPENDED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D113060 Jiang An changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |de34 at live dot cn --- Comment #4 from Jiang An --- Hi, I found that we can support std::variant(IC{}) with C++17 core language rules (as modified by P2280R4), and thus P3146 should be updated. Proof-of-concept example (https://gcc.godbolt.org/z/174sx397f): ``` #include #include template struct array_element_initialization_tester { Ti elems[1]; }; template auto test_array_element_initializable(Tp&& t) -> decltype((void) array_element_initialization_tester{{std::forward(t)}}); template constexpr bool is_array_element_initializable_from =3D false; template constexpr bool is_array_element_initializable_from(std::declval()))> = =3D true; template , int> =3D 0> void FUN(float); int main() { using IC =3D std::integral_constant; FUN(IC{}); IC ic; FUN(ic); } ``` Note that this example adds a mediate function template (test_array_element_initializable) to "reduce" the non-constexpr-ness of std::declval.=