From 6fe3003b88eb205ce96a954df75190e6edc0d78c Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Wed, 24 Jul 2024 16:50:55 +0900 Subject: [PATCH] temporary workaround for an internal compiler error in MSVC (fixes issue #613) --- include/nanobind/nb_func.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/nanobind/nb_func.h b/include/nanobind/nb_func.h index e53e1a42..22684050 100644 --- a/include/nanobind/nb_func.h +++ b/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)