diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 91c9ce753..2b382ddfd 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1498,7 +1498,9 @@ public: } explicit operator type*() { return this->value; } - explicit operator type&() { return *(this->value); } + // static_cast works around compiler error with MSVC 17 and CUDA 10.2 + // see issue #2180 + explicit operator type&() { return *(static_cast(this->value)); } explicit operator holder_type*() { return std::addressof(holder); } // Workaround for Intel compiler bug