Skip to content

Commit

Permalink
Try to work around MSVC2017 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Apr 30, 2024
1 parent 4310576 commit a8476b4
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions thrust/thrust/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,23 @@ struct __is_tuple_of_iterator_references : _CUDA_VSTD::false_type
* \see tuple_size
* \see tie
*/
#if defined(_CCCL_COMPILER_MSVC_2017)
// MSVC2017 either cannot find the constructors of the base class ::cuda::std::tuple or it declares them ambiguous.
// Make CI happy at the expense of

template <class... Ts>
using tuple = ::cuda::std::tuple<Ts...>;

using ::cuda::std::get;
using ::cuda::std::make_tuple;
using ::cuda::std::tie;

#else // !_CCCL_COMPILER_MSVC_2017
template <class... Ts>
struct tuple : public _CUDA_VSTD::tuple<Ts...>
{
using super_t = _CUDA_VSTD::tuple<Ts...>;
using super_t::super_t;

tuple() = default;

Expand All @@ -169,18 +182,6 @@ struct tuple : public _CUDA_VSTD::tuple<Ts...>
_CUDA_VSTD::__make_tuple_indices_t<sizeof...(Ts)>()))
{}

#if defined(_CCCL_COMPILER_MSVC_2017)
// MSVC cannot pull in the converting constructor for whatever reason
template <class... _Args,
_CUDA_VSTD::__enable_if_t<_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_constructible, super_t, _Args...), int> = 0>
_LIBCUDACXX_INLINE_VISIBILITY constexpr tuple(_Args&&... __args) noexcept(
_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_nothrow_constructible, super_t, _Args...))
: super_t(_CUDA_VSTD::forward<_Args>(__args)...)
{}
#else // ^^^ _CCCL_COMPILER_MSVC_2017 ^^^ / vvv !_CCCL_COMPILER_MSVC_2017 vvv
using super_t::super_t;
#endif // !_CCCL_COMPILER_MSVC_2017

_CCCL_EXEC_CHECK_DISABLE
template <class TupleLike,
_CUDA_VSTD::__enable_if_t<_CUDA_VSTD::__tuple_assignable<TupleLike, super_t>::value, int> = 0>
Expand All @@ -191,7 +192,7 @@ struct tuple : public _CUDA_VSTD::tuple<Ts...>
}
};

#if _CCCL_STD_VER >= 2017
# if _CCCL_STD_VER >= 2017
template <class... Ts>
_CCCL_HOST_DEVICE tuple(Ts...) -> tuple<Ts...>;

Expand All @@ -200,7 +201,7 @@ struct pair;

template <class T1, class T2>
_CCCL_HOST_DEVICE tuple(pair<T1, T2>) -> tuple<T1, T2>;
#endif // _CCCL_STD_VER >= 2017
# endif // _CCCL_STD_VER >= 2017

template <class... Ts>
inline _CCCL_HOST_DEVICE
Expand All @@ -224,6 +225,7 @@ inline _CCCL_HOST_DEVICE tuple<Ts&...> tie(Ts&... ts) noexcept
}

using _CUDA_VSTD::get;
#endif // !_CCCL_COMPILER_MSVC_2017

/*! \endcond
*/
Expand Down

0 comments on commit a8476b4

Please sign in to comment.