Skip to content

Commit

Permalink
nanobind: temporary workaround for an internal compiler error in MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 6, 2024
1 parent d25b903 commit e771f68
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extern/nanobind/include/nanobind/nb_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,24 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),

PyObject *result;
if constexpr (std::is_void_v<Return>) {
#if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC
cap->func(static_cast<cast_t<Args>>(in.template get<Is>())...);
#else
cap->func(in.template get<Is>().operator cast_t<Args>()...);
#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<cast_t<Args>>(in.template get<Is>())...),
policy, cleanup).ptr();
#else
result = cast_out::from_cpp(
cap->func((in.template get<Is>())
.operator cast_t<Args>()...),
policy, cleanup).ptr();
#endif
}

if constexpr (Info::keep_alive)
Expand Down

0 comments on commit e771f68

Please sign in to comment.