From 706a7d96bd42a97f34f578af38a18666427a440d Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Tue, 4 Jul 2017 01:27:18 +0200 Subject: [PATCH] Fix compilation with Intel's compiler ICC was reporting that `try_direct_conversions()` cannot be `constexpr` because `handle` is not a literal type. The fix removes `constexpr` from the function since it isn't strictly needed. This commit also suppresses new false positive warnings which mostly appear in constexpr contexts (where the compiler knows conversions are safe). --- include/pybind11/cast.h | 4 ++-- include/pybind11/pybind11.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 0c5c1bb1..c7b8edc6 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -846,7 +846,7 @@ protected: } template ::value>> - static auto make_move_constructor(const T *x) -> decltype(new T(std::move(*(T *) x)), Constructor{}) { + static auto make_move_constructor(const T *x) -> decltype(new T(std::move(*const_cast(x))), Constructor{}) { return [](const void *arg) -> void * { return new T(std::move(*const_cast(reinterpret_cast(arg)))); }; @@ -1404,7 +1404,7 @@ protected: return false; } - static constexpr bool try_direct_conversions(handle) { return false; } + static bool try_direct_conversions(handle) { return false; } holder_type holder; diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 6084d968..fea2c0a0 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -21,8 +21,12 @@ # pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified #elif defined(__INTEL_COMPILER) # pragma warning(push) +# pragma warning(disable: 68) // integer conversion resulted in a change of sign # pragma warning(disable: 186) // pointless comparison of unsigned integer with zero +# pragma warning(disable: 878) // incompatible exception specifications # pragma warning(disable: 1334) // the "template" keyword used for syntactic disambiguation may only be used within a template +# pragma warning(disable: 1682) // implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) +# pragma warning(disable: 1875) // offsetof applied to non-POD (Plain Old Data) types is nonstandard # pragma warning(disable: 2196) // warning #2196: routine is both "inline" and "noinline" #elif defined(__GNUG__) && !defined(__clang__) # pragma GCC diagnostic push