public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "harald at gigawatt dot nl" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-115222-4-yKINFhuCCy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115222-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #5 from Harald van Dijk <harald at gigawatt dot nl> ---
I end up with a different reduced test case that does not involve unions:

template <typename _Tp> _Tp declval() noexcept;

template <typename _Tp>
inline constexpr bool is_nothrow_destructible_v = noexcept(declval<_Tp>());

struct A { ~A() noexcept(false) = delete; };
struct B : A { ~B(); };
static_assert(is_nothrow_destructible_v<B>);

The assertion passes in GCC, fails in clang, but I think clang is right here.
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 any of
the destructors for any of its potentially constructed subobjects has a
potentially-throwing exception specification" without regard to whether those
destructors are deleted.

  parent reply	other threads:[~2024-05-25 12:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-25  0:53 [Bug c++/115222] New: clang does not think libstdc++'s std::optional is nothrow destructible pobrn at protonmail dot com
2024-05-25  1:12 ` [Bug c++/115222] " pinskia at gcc dot gnu.org
2024-05-25  2:07 ` [Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union pinskia at gcc dot gnu.org
2024-05-25  2:16 ` pinskia at gcc dot gnu.org
2024-05-25  2:29 ` pinskia at gcc dot gnu.org
2024-05-25 12:44 ` harald at gigawatt dot nl [this message]
2024-06-10 16:35 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115222-4-yKINFhuCCy@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).