mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Workaround NVCC parse failure in cast_op
(#4893)
* Workaround NVCC parse failure in `cast_op` There is a bug in some CUDA versions (observed in CUDA 12.1 and 11.7 w/ GCC 12.2), that makes `cast_op` fail to compile: `cast.h:45:120: error: expected template-name before ‘<’ token` Defining the nested type as an alias and using it allows this to work without any change in semantics. Fixes #4606 * style: pre-commit fixes * Add comments to result_t referencing PR --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7969049de4
commit
3414c56b6c
@ -42,13 +42,15 @@ using make_caster = type_caster<intrinsic_t<type>>;
|
|||||||
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
|
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &caster) {
|
typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &caster) {
|
||||||
return caster.operator typename make_caster<T>::template cast_op_type<T>();
|
using result_t = typename make_caster<T>::template cast_op_type<T>; // See PR #4893
|
||||||
|
return caster.operator result_t();
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename make_caster<T>::template cast_op_type<typename std::add_rvalue_reference<T>::type>
|
typename make_caster<T>::template cast_op_type<typename std::add_rvalue_reference<T>::type>
|
||||||
cast_op(make_caster<T> &&caster) {
|
cast_op(make_caster<T> &&caster) {
|
||||||
return std::move(caster).operator typename make_caster<T>::
|
using result_t = typename make_caster<T>::template cast_op_type<
|
||||||
template cast_op_type<typename std::add_rvalue_reference<T>::type>();
|
typename std::add_rvalue_reference<T>::type>; // See PR #4893
|
||||||
|
return std::move(caster).operator result_t();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename type>
|
template <typename type>
|
||||||
|
Loading…
Reference in New Issue
Block a user