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

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 15 02:58:38 PST 2025


================
@@ -32,7 +32,7 @@
 #endif
 
 #if defined(_LIBCPP_ABI_VCRUNTIME)
-#  include <new.h>
+#  include <vcruntime_new.h>
----------------
siradam7th wrote:

If you include `<new.h>` you'll get a lot of redeclaration warnings in multiple places:
```
C:/BUILD/llvm-project/build/include/c++/v1\__new/new_handler.h(20,39): warning: redeclaration of 'std::set_new_handler' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
   20 | _LIBCPP_EXPORTED_FROM_ABI new_handler set_new_handler(new_handler) _NOEXCEPT;
      |                                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\new.h(32,42): note: previous declaration is here
   32 |             _CRTIMP2 new_handler __cdecl set_new_handler(_In_opt_ new_handler _NewHandler) throw();
```

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


More information about the libcxx-commits mailing list