[libcxx-commits] [libcxx] [libc++] Provide sized deallocation declarations even when the compiler doesn't support sized deallocation (PR #125577)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 4 11:38:43 PST 2025


ldionne wrote:

The compiler's `-fno-sized-deallocation` flag allows controlling whether delete expressions should use sized delete or not, which is a breaking change for some code, since it changes which `operator delete` gets called without making any changes to the user code. AFAIU, that's the purpose of that flag and that's the reason why it wasn't made the default until recently (upstream).

Some users might be in a situation where they don't want their `delete` expressions to resolve differently, but where it is 100% acceptable to call the sized `operator delete` explicitly. In that case, they could pass `-fno-sized-deallocation` yet still call the library function explicitly (after this patch, but not before).

For availability issues, we have attributes on these declarations: if someone attempts to use a sized `operator delete` while compiling for a target that does not support the functionality, that should be caught at compile-time by these attributes.

https://github.com/llvm/llvm-project/pull/125577


More information about the libcxx-commits mailing list