Skip to content

Commit 6fe3003

Browse files
wjakobTaylorP
authored andcommitted
temporary workaround for an internal compiler error in MSVC (fixes issue wjakob#613)
1 parent a6427f7 commit 6fe3003

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/nanobind/nb_func.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,24 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),
199199

200200
PyObject *result;
201201
if constexpr (std::is_void_v<Return>) {
202+
#if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC
203+
cap->func(static_cast<cast_t<Args>>(in.template get<Is>())...);
204+
#else
202205
cap->func(in.template get<Is>().operator cast_t<Args>()...);
206+
#endif
203207
result = Py_None;
204208
Py_INCREF(result);
205209
} else {
210+
#if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC
211+
result = cast_out::from_cpp(
212+
cap->func(static_cast<cast_t<Args>>(in.template get<Is>())...),
213+
policy, cleanup).ptr();
214+
#else
206215
result = cast_out::from_cpp(
207216
cap->func((in.template get<Is>())
208217
.operator cast_t<Args>()...),
209218
policy, cleanup).ptr();
219+
#endif
210220
}
211221

212222
if constexpr (Info::keep_alive)

0 commit comments

Comments
 (0)