28-cudacc.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. diff --git a/include/__algorithm/simd_utils.h b/include/__algorithm/simd_utils.h
  2. index 989a195..c2fc02e 100644
  3. --- a/include/__algorithm/simd_utils.h
  4. +++ b/include/__algorithm/simd_utils.h
  5. @@ -27,7 +27,7 @@ _LIBCPP_PUSH_MACROS
  6. #include <__undef_macros>
  7. // TODO: Find out how altivec changes things and allow vectorizations there too.
  8. -#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1700 && !defined(__ALTIVEC__)
  9. +#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1700 && !defined(__ALTIVEC__) && !defined(__CUDACC__)
  10. # define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 1
  11. #else
  12. # define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0
  13. diff --git a/include/__iterator/reverse_iterator.h b/include/__iterator/reverse_iterator.h
  14. index 2ae1461..3fb2a42 100644
  15. --- a/include/__iterator/reverse_iterator.h
  16. +++ b/include/__iterator/reverse_iterator.h
  17. @@ -132,7 +132,7 @@ public:
  18. return *--__tmp;
  19. }
  20. -#if _LIBCPP_STD_VER >= 20
  21. +#if _LIBCPP_STD_VER >= 20 && !defined(__CUDACC__)
  22. _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const
  23. requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); }
  24. {
  25. diff --git a/include/__iterator/segmented_iterator.h b/include/__iterator/segmented_iterator.h
  26. index f3cd1e5..c0a77ef 100644
  27. --- a/include/__iterator/segmented_iterator.h
  28. +++ b/include/__iterator/segmented_iterator.h
  29. @@ -68,8 +68,10 @@ struct __segmented_iterator_traits;
  30. template <class _Tp, size_t = 0>
  31. struct __has_specialization : false_type {};
  32. +#ifndef __CUDACC__
  33. template <class _Tp>
  34. struct __has_specialization<_Tp, sizeof(_Tp) * 0> : true_type {};
  35. +#endif
  36. template <class _Iterator>
  37. using __is_segmented_iterator = __has_specialization<__segmented_iterator_traits<_Iterator> >;
  38. diff --git a/include/__math/traits.h b/include/__math/traits.h
  39. index da585af..b271b8f 100644
  40. --- a/include/__math/traits.h
  41. +++ b/include/__math/traits.h
  42. @@ -67,7 +67,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool i
  43. return false;
  44. }
  45. -#ifdef _LIBCPP_PREFERRED_OVERLOAD
  46. +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__)
  47. _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT {
  48. return __builtin_isinf(__x);
  49. }
  50. @@ -94,7 +94,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool i
  51. return false;
  52. }
  53. -#ifdef _LIBCPP_PREFERRED_OVERLOAD
  54. +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__)
  55. _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT {
  56. return __builtin_isnan(__x);
  57. }
  58. diff --git a/include/complex b/include/complex
  59. index a81f968..1e4d99d 100644
  60. --- a/include/complex
  61. +++ b/include/complex
  62. @@ -1513,6 +1513,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<double> operator""i(unsigned long
  63. return {0.0, static_cast<double>(__im)};
  64. }
  65. +# if !defined(__CUDACC__)
  66. _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double __im) {
  67. return {0.0f, static_cast<float>(__im)};
  68. }
  69. @@ -1520,6 +1521,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(long double _
  70. _LIBCPP_HIDE_FROM_ABI inline constexpr complex<float> operator""if(unsigned long long __im) {
  71. return {0.0f, static_cast<float>(__im)};
  72. }
  73. +# endif
  74. } // namespace complex_literals
  75. } // namespace literals
  76. #endif
  77. diff --git a/include/tuple b/include/tuple
  78. index c7fc550..ed7d912 100644
  79. --- a/include/tuple
  80. +++ b/include/tuple
  81. @@ -297,7 +297,7 @@ class __tuple_leaf {
  82. template <class _Tp>
  83. static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
  84. -# if __has_keyword(__reference_binds_to_temporary)
  85. +# if __has_keyword(__reference_binds_to_temporary) && !defined(__CUDACC__)
  86. return !__reference_binds_to_temporary(_Hp, _Tp);
  87. # else
  88. return true;
  89. @@ -599,8 +599,16 @@ public:
  90. is_constructible<_Tp, _Up>... > {};
  91. template <class... _Up,
  92. - __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
  93. - int> = 0>
  94. + __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>,
  95. + _EnableUTypesCtor<_Up...>
  96. +// nvcc 12.2 cannot choose between tuple(const T& ... t) and tuple(U&&... u)
  97. +// so we have to added an explicit requires in enable_if
  98. +# ifdef __CUDACC__
  99. + ,
  100. + _Not<_And<is_copy_constructible<_Tp>..., _Lazy<_And, is_convertible<_Up, const _Tp&>...>> >
  101. +# endif
  102. + >::value,
  103. + int> = 0>
  104. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
  105. tuple(_Up&&... __u) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
  106. : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),