https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114844
Bug ID: 114844
Summary: A trivial but noexcept(false) destructor is
incorrectly considered non-throwing
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: accepts-invalid, rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
Currently, GCC incorrectly accepts the following code snippet (allowed by
P1286R2), which conflicts with [except.spec]/6.2.
```
struct TrivialButPotentiallyThrowingDestructor {
TrivialButPotentiallyThrowingDestructor() = default;
~TrivialButPotentiallyThrowingDestructor() noexcept(false) = default;
};
static_assert(noexcept(TrivialButPotentiallyThrowingDestructor{}), "???");
```
It's curious that other compilers except for EDG also get this wrong
(https://godbolt.org/z/57jf98xhc).