Skip to content

Commit bd24155

Browse files
bluescarniwjakob
authored andcommitted
Aligned allocation fix for clang-cl (pybind#1988)
1 parent deb3cb2 commit bd24155

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/pybind11/cast.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class type_caster_generic {
591591
if (type->operator_new) {
592592
vptr = type->operator_new(type->type_size);
593593
} else {
594-
#ifdef __cpp_aligned_new
594+
#if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912)
595595
if (type->type_align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
596596
vptr = ::operator new(type->type_size,
597597
std::align_val_t(type->type_align));

include/pybind11/pybind11.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ void call_operator_delete(T *p, size_t s, size_t) { T::operator delete(p, s); }
10031003

10041004
inline void call_operator_delete(void *p, size_t s, size_t a) {
10051005
(void)s; (void)a;
1006-
#ifdef __cpp_aligned_new
1006+
#if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912)
10071007
if (a > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {
10081008
#ifdef __cpp_sized_deallocation
10091009
::operator delete(p, s, std::align_val_t(a));

0 commit comments

Comments
 (0)