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).
diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
index 0c5c1bb..c7b8edc 100644
--- a/include/pybind11/cast.h
+++ b/include/pybind11/cast.h
@@ -846,7 +846,7 @@
}
template <typename T, typename = enable_if_t<std::is_move_constructible<T>::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<T *>(x))), Constructor{}) {
return [](const void *arg) -> void * {
return new T(std::move(*const_cast<T *>(reinterpret_cast<const T *>(arg))));
};
@@ -1404,7 +1404,7 @@
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 6084d96..fea2c0a 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