From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C71C3858C66; Sat, 25 May 2024 12:44:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C71C3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716641047; bh=CzinE//8+d0hUjLxNJKOyG8i+tZOn5tGUb7kdAgPBEk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=w1ef2MPaaxTCqXMiLtLn6QKsSBo8UWK4tpPw3hingHQASGV5WGK0/UwooIXx6xdnx dUxXaTL5ekUejm2QgouqQILfYZJTdB/vf1LAGmQfGXS7VsCjNspDp718bPdcM9avBf hVjiQLVet0l/AOG/S9RXeUdkiDYuN3ALyc7UooJM= From: "harald at gigawatt dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union Date: Sat, 25 May 2024 12:44:06 +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: 15.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: harald at gigawatt dot nl 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=3D115222 Harald van Dijk changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #5 from Harald van Dijk --- I end up with a different reduced test case that does not involve unions: template _Tp declval() noexcept; template inline constexpr bool is_nothrow_destructible_v =3D noexcept(declval<_Tp>()= ); struct A { ~A() noexcept(false) =3D delete; }; struct B : A { ~B(); }; static_assert(is_nothrow_destructible_v); The assertion passes in GCC, fails in clang, but I think clang is right her= e. It looks like GCC ignores the deleted destructor for determining whether B's destructor should be implicitly noexcept, but the wording that Andrew Pinski referenced in comment #2 says B's destructor is potentially throwing "if an= y of the destructors for any of its potentially constructed subobjects has a potentially-throwing exception specification" without regard to whether tho= se destructors are deleted.=