28-cudacc.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. diff --git a/include/__iterator/reverse_iterator.h b/include/__iterator/reverse_iterator.h
  2. index 5900b1c..c8f3628 100644
  3. --- a/include/__iterator/reverse_iterator.h
  4. +++ b/include/__iterator/reverse_iterator.h
  5. @@ -132,7 +132,7 @@ public:
  6. return *--__tmp;
  7. }
  8. -#if _LIBCPP_STD_VER >= 20
  9. +#if _LIBCPP_STD_VER >= 20 && !defined(__CUDACC__)
  10. _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const
  11. requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
  12. {
  13. diff --git a/include/__iterator/segmented_iterator.h b/include/__iterator/segmented_iterator.h
  14. index f3cd1e5..c0a77ef 100644
  15. --- a/include/__iterator/segmented_iterator.h
  16. +++ b/include/__iterator/segmented_iterator.h
  17. @@ -68,8 +68,10 @@ struct __segmented_iterator_traits;
  18. template <class _Tp, size_t = 0>
  19. struct __has_specialization : false_type {};
  20. +#ifndef __CUDACC__
  21. template <class _Tp>
  22. struct __has_specialization<_Tp, sizeof(_Tp) * 0> : true_type {};
  23. +#endif
  24. template <class _Iterator>
  25. using __is_segmented_iterator = __has_specialization<__segmented_iterator_traits<_Iterator> >;
  26. diff --git a/include/__math/traits.h b/include/__math/traits.h
  27. index da585af..b271b8f 100644
  28. --- a/include/__math/traits.h
  29. +++ b/include/__math/traits.h
  30. @@ -67,7 +67,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool i
  31. return false;
  32. }
  33. -#ifdef _LIBCPP_PREFERRED_OVERLOAD
  34. +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__)
  35. _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT {
  36. return __builtin_isinf(__x);
  37. }
  38. @@ -94,7 +94,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool i
  39. return false;
  40. }
  41. -#ifdef _LIBCPP_PREFERRED_OVERLOAD
  42. +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__)
  43. _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT {
  44. return __builtin_isnan(__x);
  45. }
  46. diff --git a/include/complex b/include/complex
  47. index e996485..d553dad 100644
  48. --- a/include/complex
  49. +++ b/include/complex
  50. @@ -1518,6 +1518,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long
  51. return {0.0, static_cast<double>(__im)};
  52. }
  53. +# if !defined(__CUDACC__)
  54. _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) {
  55. return {0.0f, static_cast<float>(__im)};
  56. }
  57. @@ -1525,6 +1526,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double _
  58. _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) {
  59. return {0.0f, static_cast<float>(__im)};
  60. }
  61. +# endif
  62. } // namespace complex_literals
  63. } // namespace literals
  64. #endif
  65. diff --git a/include/tuple b/include/tuple
  66. index 0101d64..f2369fa 100644
  67. --- a/include/tuple
  68. +++ b/include/tuple
  69. @@ -305,7 +305,7 @@ class __tuple_leaf {
  70. template <class _Tp>
  71. static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
  72. -# if __has_keyword(__reference_binds_to_temporary)
  73. +# if __has_keyword(__reference_binds_to_temporary) && !defined(__CUDACC__)
  74. return !__reference_binds_to_temporary(_Hp, _Tp);
  75. # else
  76. return true;
  77. @@ -611,8 +611,16 @@ public:
  78. is_constructible<_Tp, _Up>... > {};
  79. template <class... _Up,
  80. - __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
  81. - int> = 0>
  82. + __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
  83. + _EnableUTypesCtor<_Up...>
  84. +// nvcc 12.2 cannot choose between tuple(const T& ... t) and tuple(U&&... u)
  85. +// so we have to added an explicit requires in enable_if
  86. +# ifdef __CUDACC__
  87. + ,
  88. + _Not<_And<is_copy_constructible<_Tp>..., _Lazy<_And, is_convertible<_Up, const _Tp&>...>> >
  89. +# endif
  90. + >::value,
  91. + int> = 0>
  92. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
  93. tuple(_Up&&... __u) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
  94. : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),