From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0BA2438582A3; Sat, 28 Oct 2023 08:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BA2438582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698481430; bh=H9T2iPljCuj8Awr+dGBDUhAFSwh/Zdh/8qVBGL0MZ8s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FP13fFLQ6OKi2crQ4QkMCcQ9CiOvpmFovFpUTc+P/Ew5VIaKMgHctyHe2ltDAvdAS eKYBExLChgW6xD0H4h+I5fwPorklxAIYQYklCDWNH6H3K3/9OJi742/bRBxciUchKv VmxCqWym0DKSuGoykEyup9270vtjMNlh5+RQBYjY= From: "nathanieloshead at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96090] noexcept operator of potentially-throwing defaulted function gives the wrong result Date: Sat, 28 Oct 2023 08:23:46 +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.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: nathanieloshead at gmail dot com 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: 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=3D96090 Nathaniel Shead changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nathanieloshead at gmail d= ot com --- Comment #2 from Nathaniel Shead --- I'm working on a patch for this. But worth noting... > static_assert(!is_nothrow_default_constructible_v); I'm not sure this is correct. By https://eel.is/c++draft/meta.unary.prop#9 = this is testing noexceptness of value-initialisation. And https://eel.is/c++draft/dcl.init.general#9.1 says > if T has either no default constructor ([class.default.ctor]) or > a default constructor that is user-provided or deleted, then > the object is default-initialized; > otherwise, the object is zero-initialized and the semantic constraints > for default-initialization are checked, and if T has a non-trivial > default constructor, the object is default-initialized; Since the default constructor here is not user-provided, and also trivial, = the object should not be default-initialized and thus the default constructor is not called, and thus this is not potentially-throwing.=