diff --git a/docs/changelog.rst b/docs/changelog.rst index b4eecab58..f03d4f4c8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,9 @@ v2.3.0 (Not yet released) v2.2.1 (Not yet released) ----------------------------------------------------- +* Fixed compilation with Clang on host GCC < 5 (old libstdc++ which isn't fully + C++11 compliant). `#1062 `_. + * Fixed a regression where the ``py::keep_alive`` policy could not be applied to constructors. `#1065 `_. diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index ce8c329bc..55bb81698 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -288,7 +288,9 @@ template using remove_all_extents_t = typename array_info::type; template using is_pod_struct = all_of< std::is_standard_layout, // since we're accessing directly in memory we need a standard layout type -#if !defined(__GNUG__) || defined(__clang__) || __GNUC__ >= 5 +#if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(_GLIBCXX_USE_CXX11_ABI) + // _GLIBCXX_USE_CXX11_ABI indicates that we're using libstdc++ from GCC 5 or newer, independent + // of the actual compiler (Clang can also use libstdc++, but it always defines __GNUC__ == 4). std::is_trivially_copyable, #else // GCC 4 doesn't implement is_trivially_copyable, so approximate it