From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C76238708EF; Mon, 28 Dec 2020 11:58:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C76238708EF From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98423] The defaulted default constructor defined as deleted when one of variant member has a default member initializer Date: Mon, 28 Dec 2020 11:58:32 +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: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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 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, 28 Dec 2020 11:58:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98423 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- I think it isn't solely about the process_subob_fn if (TREE_CODE (arg) =3D=3D FIELD_DECL && TREE_CODE (DECL_CONTEXT (arg)) =3D=3D UNION_TYPE) { if (deleted_p) *deleted_p =3D true; if (diag) error ("union member %q+D with non-trivial %qD", arg, fn); } diagnostics that probably shouldn't be performed if the union type has nsdm= i on any member, isn't it also the: if (constexpr_p && !DECL_DECLARED_CONSTEXPR_P (fn)) { *constexpr_p =3D false; if (diag) { inform (DECL_SOURCE_LOCATION (fn), SFK_DTOR_P (sfk) ? G_("defaulted destructor calls non-% %qD") : G_("defaulted constructor calls non-% %qD"), fn); explain_invalid_constexpr_fn (fn); } } diagnostics (why would a default constructor of a union be non-constexpr ju= st because some variant member without nsdmi has non-constexpr default constructor), perhaps the spec_p stuff too. So for UNION_TYPE we probably want to search for nsdmis in another loop at = the start of walk_field_subobs and punt some tests for some special members if there are any nsdmis.=