[libcxx-commits] [libcxx] [libc++] Fix missing 'get_new_handler()' for Windows builds (PR #150182)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 14 19:53:19 PDT 2025


================
@@ -11,9 +11,7 @@
 #include "include/atomic_support.h"
 
 #if defined(_LIBCPP_ABI_MICROSOFT)
-#  if !defined(_LIBCPP_ABI_VCRUNTIME)
-#    define _LIBPCPP_DEFINE_NEW_HANDLER
-#  endif
+#  define _LIBPCPP_DEFINE_NEW_HANDLER
----------------
frederick-vs-ja wrote:

> @frederick-vs-ja Can't we bundle a fixme comment, or bundle a documentation commit to this PR? When UCRT fixes this issue, this commit can be reverted.
> 
> Windows support for module usage is very important for module adoption, waiting for ucrt for this could really slow things down

Is it really a good idea to include UCRT's `<new.h>`? MSVC STL have been avoiding `<new.h>` for a long while, at least since open-sourcing (see [this](https://github.com/microsoft/STL/blob/219514876ea86491de191ceaa88632616bbc0f19/stl/inc/new)). I think a cleaner way is to follow MSVC STL's strategy - including `<vcruntime_new.h>` and manually declaring `new_handler`, `set_new_handler`, and `get_new_handler`.

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


More information about the libcxx-commits mailing list