diff --git a/extern/nanobind/include/nanobind/nb_func.h b/extern/nanobind/include/nanobind/nb_func.h index e53e1a42c..226840502 100644 --- a/extern/nanobind/include/nanobind/nb_func.h +++ b/extern/nanobind/include/nanobind/nb_func.h @@ -199,14 +199,24 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...), PyObject *result; if constexpr (std::is_void_v) { +#if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC + cap->func(static_cast>(in.template get())...); +#else cap->func(in.template get().operator cast_t()...); +#endif result = Py_None; Py_INCREF(result); } else { +#if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC + result = cast_out::from_cpp( + cap->func(static_cast>(in.template get())...), + policy, cleanup).ptr(); +#else result = cast_out::from_cpp( cap->func((in.template get()) .operator cast_t()...), policy, cleanup).ptr(); +#endif } if constexpr (Info::keep_alive)