From 48f101d07514e99f5f35046b76e988a609096a9b Mon Sep 17 00:00:00 2001 From: Ben Pritchard Date: Thu, 18 Feb 2016 12:38:27 -0500 Subject: [PATCH] Fixes for compilation/segfault problems with Intel (issue 94) --- include/pybind11/attr.h | 2 +- include/pybind11/cast.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index 15d5982aa..8c77a4127 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -277,7 +277,7 @@ template struct process_attribute void ignore_unused(const T&) { } +inline void ignore_unused(const int *) { } /// Recursively iterate over variadic template arguments template struct process_attributes { diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 2dfcc7717..b153d6ef2 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -519,9 +519,16 @@ public: explicit operator type*() { return this->value; } explicit operator type&() { return *(this->value); } - explicit operator holder_type&() { return holder; } explicit operator holder_type*() { return &holder; } + // Workaround for Intel compiler bug + // see pybind11 issue 94 + #if defined(__ICC) || defined(__INTEL_COMPILER) + operator holder_type&() { return holder; } + #else + explicit operator holder_type&() { return holder; } + #endif + static handle cast(const holder_type &src, return_value_policy policy, handle parent) { return type_caster_generic::cast( src.get(), policy, parent, &typeid(type), ©_constructor, &src);