Skip to content

Commit

Permalink
temporary workaround for an internal compiler error in MSVC (fixes is…
Browse files Browse the repository at this point in the history
…sue wjakob#613)
  • Loading branch information
wjakob authored and TaylorP committed Aug 9, 2024
1 parent a6427f7 commit 6fe3003
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 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 6fe3003

Please sign in to comment.