[clang] [win][clang] Align scalar deleting destructors with MSABI (PR #139566)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 7 06:35:10 PDT 2025
================
@@ -46,6 +46,22 @@ Potentially Breaking Changes
``endbr64`` instruction at the labels named as possible branch
destinations, so it is not safe to use a register-controlled branch
instruction to branch to one. (In line with gcc.)
+- Scalar deleting destructor support has been aligned with MSVC when
+ targeting the MSVC ABI. Clang previously implemented support for
+ ``::delete`` by calling the complete object destructor and then the
+ appropriate global delete operator (as is done for the Itanium ABI).
+ The scalar deleting destructor is now called to destroy the object
+ and deallocate its storage. This is an ABI change that can result in
+ memory corruption when a program built for the MSVC ABI has
+ portions compiled with clang 20 or earlier and portions compiled
+ with a version of clang 21 (or MSVC). Consider a class ``X`` that
+ declares a virtual destructor and an ``operator delete`` member
+ with the destructor defined in library ``A`` and a call to `::delete`` in
+ library ``B``. If library ``A`` is compiled with clang 20 and library ``B``
+ is compiled with clang 21, the ``::delete`` call might dispatch to the
+ scalar deleting destructor emitted in library ``A`` which will erroneously
+ call the member ``operator delete`` instead of the expected global
+ delete operator.
----------------
Fznamznon wrote:
No problem, added, thanks.
https://github.com/llvm/llvm-project/pull/139566
More information about the cfe-commits
mailing list