[Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222 Andrew Pinski changed: What|Removed |Added CC||janschultke at googlemail dot com --- Comment #6 from Andrew Pinski --- *** Bug 115417 has been marked as a duplicate of this bug. ***
[Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222 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 = noexcept(declval<_Tp>()); struct A { ~A() noexcept(false) = 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 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.
[Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222 --- Comment #4 from Andrew Pinski --- Hmm, my reduced testcase has slightly different behavior compared to the original one for some versions of GCC. The original testcase is partly related to PR 114844 while my reduced testcase is just missing handling of union.
[Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222 --- Comment #3 from Andrew Pinski --- C++14 (and C++11) had slightly different wording here: ``` Given a member function f of some class X, where f is an inheriting constructor (12.9) or an implicitlydeclared special member function, the set of potential exceptions of the implicitly-declared member function f consists of all the members from the following sets: if f is a destructor, the sets of potential exceptions of the destructor invocations for X’s non-variant non-static data members and for X’s virtual and direct base classes. ``` Looks like GCC just missed the rule applies to unions too.
[Bug c++/115222] gcc ignores noexcept on fields' deconstructors in an union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2024-05-25 Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- https://eel.is/c++draft/except.spec#8 is the part of the spec that matters here. Specifically: "is potentially-throwing if and only if any of the destructors for any of its potentially constructed subobjects" Confirmed.