From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A5A23857C47; Mon, 17 Aug 2020 14:24:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A5A23857C47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597674269; bh=4+TU1gpbSt7vnz4CYWWrWxeASs5KGmYC0hMfL9ixDbU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aUs1ulLkN9rj8reuAmOyPKPUupAZykemFWnyIgB02UF4pd3pWQNXNkCjtO8ZzHpK5 fGHiDSEoYI85nwAMUonMjuyobgQ2DsXTsajpsvMMi0u/CAaQW7I3ttwkWt7plcGDtF qFSMkqitTSAYEc6DPYmChWZ1ARp4UxbGiWaGYCE8= From: "dev at hrookami dot icu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96645] [9/10/11 Regression] std::variant default constructor Date: Mon, 17 Aug 2020 14:24:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: dev at hrookami dot icu X-Bugzilla-Status: NEW 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 14:24:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96645 --- Comment #2 from Sergey --- (In reply to Jonathan Wakely from comment #1) > This is not a bug in std::variant: >=20 >=20 > template > struct bool_constant > { > static constexpr bool value =3D B; > using type =3D bool_constant; > }; >=20 > using true_type =3D bool_constant; >=20 > template > struct is_default_constructible > : bool_constant<__is_constructible(T)> > { }; >=20 > void testVarStruct() > { > struct DataWithStruct { > struct A { > int number =3D 5; // compiles, if remove initialization > }; >=20 > is_default_constructible::type t =3D true_type{}; > }; > } >=20 > v.C: In function 'void testVarStruct()': > v.C:22:47: error: could not convert 'true_type{}' from 'bool_constant' > to 'bool_constant' > 22 | is_default_constructible::type t =3D true_type{}; > | ^~~~~~~~~~~ > | | > | bool_constant >=20 >=20 > This stopped working with r269032 which changed the result of the > __is_constructible built-in. >=20 > Clang also rejects this, for the same reason, but EDG accepts it. Clang compiles it if use libc++ instead of libstdc++=