From ed9d61fdfbb0dda5966650e61a38a382953e3d6e Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 19 Dec 2019 15:12:07 +0100 Subject: [PATCH] add check for min osx target in aligned delete call --- .travis.yml | 4 ++++ include/pybind11/cast.h | 3 ++- include/pybind11/pybind11.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56682556d6..dd7bad6b45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -140,6 +140,10 @@ matrix: name: Python 3.7, c++14, AppleClang 9, Debug build osx_image: xcode9.4 env: PYTHON=3.7 CPP=14 CLANG DEBUG=1 + - os: osx + name: Python 3.7, c++17, AppleClang 9, Min OSX 10.9, Debug build + osx_image: xcode9.4 + env: PYTHON=3.7 CPP=17 CLANG DEBUG=1 MACOSX_VERSION_MIN=10.9 # Test a PyPy 2.7 build - os: linux dist: trusty diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 3af6735111..f2111c8d45 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -595,7 +595,8 @@ class type_caster_generic { if (type->operator_new) { vptr = type->operator_new(type->type_size); } else { - #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) + #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) \ + && (!defined(__APPLE__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101200) 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 d95d61f7bb..d68fc594ca 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1003,7 +1003,8 @@ 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; - #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) + #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) \ + && (!defined(__APPLE__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101200) if (a > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { #ifdef __cpp_sized_deallocation ::operator delete(p, s, std::align_val_t(a));