[clang] [C++20] Destroying delete and deleted destructors (PR #118800)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 07:15:59 PST 2024
================
@@ -23,3 +30,14 @@ struct alignas(Align) B {
};
void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__> *p) { delete p; }
void f(B<__STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2> *p) { delete p; } // expected-error {{deleted}}
+
+// Ensure that a deleted destructor is acceptable when the selected overload
+// for operator delete is a destroying delete. See the comments in GH118660.
+struct S {
+ ~S() = delete;
+ void operator delete(S *, std::destroying_delete_t) noexcept {}
+};
+
+void foo(S *s) {
+ delete s; // Was rejected, is intended to be accepted.
+}
----------------
AaronBallman wrote:
Good call, that identified an issue which I've now fixed.
https://github.com/llvm/llvm-project/pull/118800
More information about the cfe-commits
mailing list