From bd24155b8bf798f9f7022b39acd6d92e52d642d6 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 16 Nov 2019 01:18:24 +0100 Subject: [PATCH] Aligned allocation fix for clang-cl (#1988) --- include/pybind11/cast.h | 2 +- include/pybind11/pybind11.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 3d4a759c3..ad225312d 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -591,7 +591,7 @@ public: if (type->operator_new) { vptr = type->operator_new(type->type_size); } else { - #ifdef __cpp_aligned_new + #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) if (type->type_align > __STDCPP_DEFAULT_NEW_ALIGNMENT__) vptr = ::operator new(type->type_size, std::align_val_t(type->type_align)); diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 513ceed5d..d95d61f7b 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1003,7 +1003,7 @@ void call_operator_delete(T *p, size_t s, size_t) { T::operator delete(p, s); } inline void call_operator_delete(void *p, size_t s, size_t a) { (void)s; (void)a; - #ifdef __cpp_aligned_new + #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) if (a > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { #ifdef __cpp_sized_deallocation ::operator delete(p, s, std::align_val_t(a));