@@ -119,6 +119,7 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),
119
119
constexpr size_t
120
120
kwonly_pos_1 = index_1_v<std::is_same_v<kw_only, Extra>...>,
121
121
kwonly_pos_n = index_n_v<std::is_same_v<kw_only, Extra>...>;
122
+
122
123
// Arguments after nb::args are implicitly keyword-only even if there is no
123
124
// nb::kw_only annotation
124
125
constexpr bool explicit_kw_only = kwonly_pos_1 != sizeof ...(Extra);
@@ -147,6 +148,8 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),
147
148
std::make_index_sequence<sizeof ...(Extra)>())
148
149
: nargs;
149
150
151
+ (void ) kwonly_pos_n;
152
+
150
153
if constexpr (explicit_kw_only) {
151
154
static_assert (kwonly_pos_1 == kwonly_pos_n,
152
155
" Repeated use of nb::kw_only annotation!" );
@@ -253,15 +256,15 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),
253
256
254
257
PyObject *result;
255
258
if constexpr (std::is_void_v<Return>) {
256
- #if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC
259
+ #if defined(_WIN32) && !defined(__CUDACC__) // temporary workaround for an internal compiler error in MSVC
257
260
cap->func (static_cast <cast_t <Args>>(in.template get <Is>())...);
258
261
#else
259
262
cap->func (in.template get <Is>().operator cast_t <Args>()...);
260
263
#endif
261
264
result = Py_None;
262
265
Py_INCREF (result);
263
266
} else {
264
- #if defined(_WIN32) // temporary workaround for an internal compiler error in MSVC
267
+ #if defined(_WIN32) && !defined(__CUDACC__) // temporary workaround for an internal compiler error in MSVC
265
268
result = cast_out::from_cpp (
266
269
cap->func (static_cast <cast_t <Args>>(in.template get <Is>())...),
267
270
policy, cleanup).ptr ();
@@ -300,9 +303,10 @@ NB_INLINE PyObject *func_create(Func &&func, Return (*)(Args...),
300
303
301
304
// Fill remaining fields of 'f'
302
305
size_t arg_index = 0 ;
303
- (void ) arg_index;
304
306
(func_extra_apply (f, extra, arg_index), ...);
305
307
308
+ (void ) arg_index;
309
+
306
310
return nb_func_new ((const void *) &f);
307
311
}
308
312
0 commit comments