public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115417] New: Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union
@ 2024-06-10 16:33 janschultke at googlemail dot com
  2024-06-10 16:35 ` [Bug c++/115417] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: janschultke at googlemail dot com @ 2024-06-10 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115417
           Summary: Destructor is noexcept even though the class has a
                    throwing destructor subobject in an anonymous union
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janschultke at googlemail dot com
  Target Milestone: ---

Consider the following code:

#include <type_traits>

struct D {
    ~D() noexcept(false);
};

struct B {
    union {
        char c;
        D d;
    };

    ~B() {}
};

static_assert(std::is_nothrow_destructible_v<B>);


This assertion passes only for GCC, but not for other compilers
(https://godbolt.org/z/e5jEKzjfs).

I believe GCC is wrong because 'd' is a potentially constructed subobject of B
(https://eel.is/c++draft/except.spec#8) and therefore, a destructor without a
noexcept-specifier should be potentially throwing.

This bug could be related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109768, but I don't think it is a
duplicate.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115417] Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union
  2024-06-10 16:33 [Bug c++/115417] New: Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union janschultke at googlemail dot com
@ 2024-06-10 16:35 ` pinskia at gcc dot gnu.org
  2024-06-10 16:36 ` pinskia at gcc dot gnu.org
  2024-06-10 16:37 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-10 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 115222.

*** This bug has been marked as a duplicate of bug 115222 ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115417] Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union
  2024-06-10 16:33 [Bug c++/115417] New: Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union janschultke at googlemail dot com
  2024-06-10 16:35 ` [Bug c++/115417] " pinskia at gcc dot gnu.org
@ 2024-06-10 16:36 ` pinskia at gcc dot gnu.org
  2024-06-10 16:37 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-10 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note it is not just anonymous unions, it is all unions.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115417] Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union
  2024-06-10 16:33 [Bug c++/115417] New: Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union janschultke at googlemail dot com
  2024-06-10 16:35 ` [Bug c++/115417] " pinskia at gcc dot gnu.org
  2024-06-10 16:36 ` pinskia at gcc dot gnu.org
@ 2024-06-10 16:37 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-10 16:37 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2024-06-10
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=115222

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually let's reopen this for a second since of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115222#c4 .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-10 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 16:33 [Bug c++/115417] New: Destructor is noexcept even though the class has a throwing destructor subobject in an anonymous union janschultke at googlemail dot com
2024-06-10 16:35 ` [Bug c++/115417] " pinskia at gcc dot gnu.org
2024-06-10 16:36 ` pinskia at gcc dot gnu.org
2024-06-10 16:37 ` pinskia at gcc dot gnu.org

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).