1 // RUN: %clang_cc1 -fsyntax-only -verify -fcxx-exceptions -Wno-unevaluated-expression -std=c++20 %s
2 // expected-no-diagnostics
5 struct destroying_delete_t
{
6 explicit destroying_delete_t() = default;
9 inline constexpr destroying_delete_t destroying_delete
{};
13 ~Explicit() noexcept(false) {}
15 void operator delete(Explicit
*, std::destroying_delete_t
) noexcept
{
19 Explicit
*qn
= nullptr;
20 // This assertion used to fail, see GH118660
21 static_assert(noexcept(delete(qn
)));
23 struct ThrowingDestroyingDelete
{
24 ~ThrowingDestroyingDelete() noexcept(false) {}
26 void operator delete(ThrowingDestroyingDelete
*, std::destroying_delete_t
) noexcept(false) {
30 ThrowingDestroyingDelete
*pn
= nullptr;
31 // noexcept should return false here because the destroying delete itself is a
32 // potentially throwing function.
33 static_assert(!noexcept(delete(pn
)));