diff --git a/cub/cub/thread/thread_reduce.cuh b/cub/cub/thread/thread_reduce.cuh index 5727b395b04..294bc449e31 100644 --- a/cub/cub/thread/thread_reduce.cuh +++ b/cub/cub/thread/thread_reduce.cuh @@ -627,7 +627,8 @@ _CCCL_NODISCARD _CCCL_DEVICE _CCCL_FORCEINLINE AccumT ThreadReduce(const Input& ::cuda::minimum<>, ::cuda::minimum, cub::internal::SimdMin, - cub::internal::SimdMax>()) + cub::internal::SimdMax>() + || sizeof(ValueT) >= 8) { return cub::internal::ThreadReduceSequential(input, reduction_op); } diff --git a/libcudacxx/include/cuda/std/__concepts/common_with.h b/libcudacxx/include/cuda/std/__concepts/common_with.h index 20bb3680755..0c559aff98e 100644 --- a/libcudacxx/include/cuda/std/__concepts/common_with.h +++ b/libcudacxx/include/cuda/std/__concepts/common_with.h @@ -51,8 +51,8 @@ _CCCL_CONCEPT _Common_type_exists = _CCCL_FRAGMENT(__common_type_exists_, _Tp, _ template _CCCL_CONCEPT_FRAGMENT(__common_type_constructible_, requires()(requires(_Common_type_exists<_Tp, _Up>), - static_cast>(_CUDA_VSTD::declval<_Tp>()), - static_cast>(_CUDA_VSTD::declval<_Up>()))); + (static_cast>(_CUDA_VSTD::declval<_Tp>())), + (static_cast>(_CUDA_VSTD::declval<_Up>())))); template _CCCL_CONCEPT _Common_type_constructible = _CCCL_FRAGMENT(__common_type_constructible_, _Tp, _Up); diff --git a/libcudacxx/include/cuda/std/__concepts/concept_macros.h b/libcudacxx/include/cuda/std/__concepts/concept_macros.h index a22231defa9..4cbf3e5e9b3 100644 --- a/libcudacxx/include/cuda/std/__concepts/concept_macros.h +++ b/libcudacxx/include/cuda/std/__concepts/concept_macros.h @@ -86,11 +86,10 @@ _CCCL_INLINE_VAR constexpr int __cccl_requires = 0; # endif // !_CCCL_COMPILER(MSVC) template -_LIBCUDACXX_HIDE_FROM_ABI auto __cccl_make_dependent(_Tp*, __cccl_tag<_Args...>*) -> _Tp; +extern _Tp __cccl_make_dependent; template -using __cccl_requires_expr_impl = - decltype(__cccl_make_dependent(static_cast<_Impl*>(nullptr), static_cast<__cccl_tag*>(nullptr))); +using __cccl_requires_expr_impl = decltype(__cccl_make_dependent<_Impl, _Args...>); // So that we can refer to the ::cuda::std namespace below _LIBCUDACXX_BEGIN_NAMESPACE_STD @@ -186,9 +185,8 @@ namespace __cccl_unqualified_cuda_std = _CUDA_VSTD; // NOLINT(misc-unused-alias- # endif # define _CCCL_CONCEPT_FRAGMENT_REQS_requires(...) (__VA_ARGS__)->__cccl_enable_if_t < _CCCL_CONCEPT_FRAGMENT_REQS_2_ # define _CCCL_CONCEPT_FRAGMENT_REQS_2_(...) _CCCL_CONCEPT_FRAGMENT_TRUE(__VA_ARGS__) -# define _CCCL_CONCEPT_FRAGMENT_REQS_M(_REQ) \ - _CCCL_PP_CAT2(_CCCL_CONCEPT_FRAGMENT_REQS_M, _CCCL_PP_IS_PAREN(_REQ)) \ - (_REQ), +# define _CCCL_CONCEPT_FRAGMENT_REQS_M(_REQ) \ + void(), _CCCL_PP_CAT2(_CCCL_CONCEPT_FRAGMENT_REQS_M, _CCCL_PP_IS_PAREN(_REQ))(_REQ), # define _CCCL_CONCEPT_FRAGMENT_REQS_REQUIRES_requires(...) ::__cccl_requires<__VA_ARGS__> # define _CCCL_CONCEPT_FRAGMENT_REQS_REQUIRES_typename(...) static_cast<::__cccl_tag<__VA_ARGS__>*>(nullptr) # if _CCCL_COMPILER(GCC, <, 14) @@ -243,30 +241,27 @@ namespace __cccl_unqualified_cuda_std = _CUDA_VSTD; // NOLINT(misc-unused-alias- # define _CCCL_REQUIRES_EXPR_EXPAND_TPARAMS(...) _CCCL_PP_FOR_EACH(_CCCL_REQUIRES_EXPR_EXPAND_TPARAM, __VA_ARGS__) # define _CCCL_REQUIRES_EXPR(_TY, ...) _CCCL_REQUIRES_EXPR_IMPL(_TY, _CCCL_COUNTER(), __VA_ARGS__) -# define _CCCL_REQUIRES_EXPR_IMPL(_TY, _ID, ...) \ - ::__cccl_requires_expr_impl< \ - struct _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID) _CCCL_REQUIRES_EXPR_EXPAND_TPARAMS \ - _TY>::__cccl_is_satisfied(static_cast<::__cccl_tag*>(nullptr), \ - static_cast(nullptr)); \ - struct _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID) \ - { \ - using __cccl_self_t = _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID); \ - template \ +# define _CCCL_REQUIRES_EXPR_IMPL(_TY, _ID, ...) \ + ::__cccl_requires_expr_impl:: \ + __cccl_is_satisfied(static_cast<::__cccl_tag*>(nullptr), 0); \ + struct _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID) \ + { \ + using __cccl_self_t = _CCCL_PP_CAT(__cccl_requires_expr_detail_, _ID); \ + template \ _LIBCUDACXX_HIDE_FROM_ABI static auto __cccl_well_formed(__VA_ARGS__) _CCCL_REQUIRES_EXPR_2 -# define _CCCL_REQUIRES_EXPR_2(...) \ - ->decltype(_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_FRAGMENT_REQS_M, __VA_ARGS__) void()) {} \ - template (&__cccl_self_t::__cccl_well_formed<_Args...>))> \ - _LIBCUDACXX_HIDE_FROM_ABI static constexpr bool __cccl_is_satisfied(::__cccl_tag<_Args...>*, _Sig*) \ - { \ - return true; \ - } \ - _LIBCUDACXX_HIDE_FROM_ABI static constexpr bool __cccl_is_satisfied(void*, ...) \ - { \ - return false; \ - } \ +# define _CCCL_REQUIRES_EXPR_2(...) \ + ->decltype(_CCCL_PP_FOR_EACH(_CCCL_CONCEPT_FRAGMENT_REQS_M, __VA_ARGS__) void()) {} \ + template )> \ + _LIBCUDACXX_HIDE_FROM_ABI static constexpr bool __cccl_is_satisfied(::__cccl_tag<_Args...>*, int) \ + { \ + return true; \ + } \ + _LIBCUDACXX_HIDE_FROM_ABI static constexpr bool __cccl_is_satisfied(void*, long) \ + { \ + return false; \ + } \ } # endif // ^^^ _CCCL_NO_CONCEPTS ^^^ diff --git a/libcudacxx/include/cuda/std/__functional/ranges_operations.h b/libcudacxx/include/cuda/std/__functional/ranges_operations.h index 059eda975f4..b15d3960202 100644 --- a/libcudacxx/include/cuda/std/__functional/ranges_operations.h +++ b/libcudacxx/include/cuda/std/__functional/ranges_operations.h @@ -24,7 +24,7 @@ #include #include -#if _CCCL_STD_VER >= 2017 +#if _CCCL_STD_VER >= 2014 _LIBCUDACXX_BEGIN_NAMESPACE_RANGES _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI diff --git a/libcudacxx/include/cuda/std/__iterator/concepts.h b/libcudacxx/include/cuda/std/__iterator/concepts.h index ef36ad11f9d..bd24b7e3803 100644 --- a/libcudacxx/include/cuda/std/__iterator/concepts.h +++ b/libcudacxx/include/cuda/std/__iterator/concepts.h @@ -254,7 +254,7 @@ concept indirectly_copyable_storable = // Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle // (both iter_swap and indirectly_swappable require indirectly_readable). -#elif _CCCL_STD_VER > 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ +#elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ // [iterator.concept.readable] template diff --git a/libcudacxx/include/cuda/std/__iterator/incrementable_traits.h b/libcudacxx/include/cuda/std/__iterator/incrementable_traits.h index 4555b4ae412..d188a4ae66c 100644 --- a/libcudacxx/include/cuda/std/__iterator/incrementable_traits.h +++ b/libcudacxx/include/cuda/std/__iterator/incrementable_traits.h @@ -88,7 +88,7 @@ using iter_difference_t = incrementable_traits>, iterator_traits>>::difference_type; -#elif _CCCL_STD_VER > 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ +#elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ // [incrementable.traits] template @@ -150,7 +150,7 @@ using iter_difference_t = incrementable_traits>, iterator_traits>>::difference_type; -#endif // _CCCL_STD_VER > 2014 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/__iterator/indirectly_comparable.h b/libcudacxx/include/cuda/std/__iterator/indirectly_comparable.h index bc5c2b615e5..7646e3dfb94 100644 --- a/libcudacxx/include/cuda/std/__iterator/indirectly_comparable.h +++ b/libcudacxx/include/cuda/std/__iterator/indirectly_comparable.h @@ -33,7 +33,7 @@ template , projected<_Iter2, _Proj2>>; -#elif _CCCL_STD_VER > 2014 +#elif _CCCL_STD_VER >= 2014 // clang-format off @@ -50,7 +50,7 @@ _CCCL_CONCEPT indirectly_comparable = // clang-format on -#endif // _CCCL_STD_VER > 2014 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/__iterator/iter_move.h b/libcudacxx/include/cuda/std/__iterator/iter_move.h index 54ce7692c1e..22a13ef33ae 100644 --- a/libcudacxx/include/cuda/std/__iterator/iter_move.h +++ b/libcudacxx/include/cuda/std/__iterator/iter_move.h @@ -33,7 +33,7 @@ _CCCL_DIAG_PUSH _CCCL_DIAG_SUPPRESS_CLANG("-Wvoid-ptr-dereference") -#if _CCCL_STD_VER > 2014 +#if _CCCL_STD_VER >= 2014 // [iterator.cust.move] diff --git a/libcudacxx/include/cuda/std/__iterator/iter_swap.h b/libcudacxx/include/cuda/std/__iterator/iter_swap.h index bafeed69742..d58e2b3740e 100644 --- a/libcudacxx/include/cuda/std/__iterator/iter_swap.h +++ b/libcudacxx/include/cuda/std/__iterator/iter_swap.h @@ -30,7 +30,7 @@ #include #include -#if _CCCL_STD_VER > 2014 +#if _CCCL_STD_VER >= 2014 // [iter.cust.swap] @@ -158,6 +158,6 @@ _CCCL_INLINE_VAR constexpr bool __noexcept_swappable<_I1, _I2, enable_if_t 2014 +#endif // _CCCL_STD_VER >= 2014 #endif // _LIBCUDACXX___ITERATOR_ITER_SWAP_H diff --git a/libcudacxx/include/cuda/std/__iterator/iterator_traits.h b/libcudacxx/include/cuda/std/__iterator/iterator_traits.h index 2168ea2fd5c..095880f7cce 100644 --- a/libcudacxx/include/cuda/std/__iterator/iterator_traits.h +++ b/libcudacxx/include/cuda/std/__iterator/iterator_traits.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -93,7 +92,7 @@ using iter_reference_t = decltype(*declval<_Tp&>()); template struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits; -#elif _CCCL_STD_VER > 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ +#elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ template using __with_reference = _Tp&; @@ -119,10 +118,10 @@ using iter_reference_t = enable_if_t<__dereferenceable<_Tp>, decltype(*declval<_ template struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits; -#else // ^^^ _CCCL_STD_VER > 2014 ^^^ / vvv _CCCL_STD_VER <= 2014 vvv +#else // ^^^ _CCCL_STD_VER >= 2014 ^^^ / vvv _CCCL_STD_VER < 2014 vvv template struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits; -#endif // _CCCL_STD_VER <= 2014 +#endif // _CCCL_STD_VER < 2014 #if _CCCL_COMPILER(NVRTC) @@ -530,7 +529,7 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits : __iterator_traits<_Ip> using __primary_template = iterator_traits; }; -#elif _CCCL_STD_VER > 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ / vvv _CCCL_STD_VER > 2014 vvv +#elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ / vvv _CCCL_STD_VER > 2014 vvv // The `cpp17-*-iterator` exposition-only concepts have very similar names to the `Cpp17*Iterator` named requirements // from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to @@ -860,7 +859,7 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT iterator_traits<_Tp*> typedef _Tp* pointer; typedef typename add_lvalue_reference<_Tp>::type reference; typedef random_access_iterator_tag iterator_category; -#if _CCCL_STD_VER > 2014 +#if _CCCL_STD_VER >= 2014 typedef contiguous_iterator_tag iterator_concept; #endif }; diff --git a/libcudacxx/include/cuda/std/__iterator/mergeable.h b/libcudacxx/include/cuda/std/__iterator/mergeable.h index 7c788375bc6..62a9a90a662 100644 --- a/libcudacxx/include/cuda/std/__iterator/mergeable.h +++ b/libcudacxx/include/cuda/std/__iterator/mergeable.h @@ -41,7 +41,7 @@ concept mergeable = && indirectly_copyable<_Input1, _Output> && indirectly_copyable<_Input2, _Output> && indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>; -#elif _CCCL_STD_VER > 2014 +#elif _CCCL_STD_VER >= 2014 template _CCCL_CONCEPT_FRAGMENT( diff --git a/libcudacxx/include/cuda/std/__iterator/permutable.h b/libcudacxx/include/cuda/std/__iterator/permutable.h index 599ede609ef..36968925759 100644 --- a/libcudacxx/include/cuda/std/__iterator/permutable.h +++ b/libcudacxx/include/cuda/std/__iterator/permutable.h @@ -32,7 +32,7 @@ template concept permutable = forward_iterator<_Iterator> && indirectly_movable_storable<_Iterator, _Iterator> && indirectly_swappable<_Iterator, _Iterator>; -#elif _CCCL_STD_VER > 2014 +#elif _CCCL_STD_VER >= 2014 template _CCCL_CONCEPT_FRAGMENT(__permutable_, @@ -43,7 +43,7 @@ _CCCL_CONCEPT_FRAGMENT(__permutable_, template _CCCL_CONCEPT permutable = _CCCL_FRAGMENT(__permutable_, _Iterator); -#endif // _CCCL_STD_VER > 2014 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/__iterator/projected.h b/libcudacxx/include/cuda/std/__iterator/projected.h index e8639b48d3b..d65eb462483 100644 --- a/libcudacxx/include/cuda/std/__iterator/projected.h +++ b/libcudacxx/include/cuda/std/__iterator/projected.h @@ -27,7 +27,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD -#if _CCCL_STD_VER > 2014 +#if _CCCL_STD_VER >= 2014 template struct __projected_impl @@ -54,7 +54,7 @@ _CCCL_TEMPLATE(class _It, class _Proj) _CCCL_REQUIRES(indirectly_readable<_It> _CCCL_AND indirectly_regular_unary_invocable<_Proj, _It>) using projected = typename __projected_impl<_It, _Proj>::__type; -#endif // _CCCL_STD_VER > 2014 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/__iterator/readable_traits.h b/libcudacxx/include/cuda/std/__iterator/readable_traits.h index b73086dd968..8e5a1266d55 100644 --- a/libcudacxx/include/cuda/std/__iterator/readable_traits.h +++ b/libcudacxx/include/cuda/std/__iterator/readable_traits.h @@ -106,7 +106,7 @@ using iter_value_t = indirectly_readable_traits>, iterator_traits>>::value_type; -#elif _CCCL_STD_VER > 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ +#elif _CCCL_STD_VER >= 2014 // ^^^ !_CCCL_NO_CONCEPTS ^^^ // [readable.traits] template diff --git a/libcudacxx/include/cuda/std/__iterator/sortable.h b/libcudacxx/include/cuda/std/__iterator/sortable.h index 51cd2b00398..9656add726e 100644 --- a/libcudacxx/include/cuda/std/__iterator/sortable.h +++ b/libcudacxx/include/cuda/std/__iterator/sortable.h @@ -34,7 +34,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD template concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>; -#elif _CCCL_STD_VER > 2014 +#elif _CCCL_STD_VER >= 2014 template _CCCL_CONCEPT_FRAGMENT( @@ -44,7 +44,7 @@ _CCCL_CONCEPT_FRAGMENT( template _CCCL_CONCEPT sortable = _CCCL_FRAGMENT(__sortable_, _Iter, _Comp, _Proj); -#endif // _CCCL_STD_VER > 2014 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/__ranges/access.h b/libcudacxx/include/cuda/std/__ranges/access.h index 3c5ef7da52b..c6ba238ea41 100644 --- a/libcudacxx/include/cuda/std/__ranges/access.h +++ b/libcudacxx/include/cuda/std/__ranges/access.h @@ -33,7 +33,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER > 2014 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 template _CCCL_CONCEPT __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range>; @@ -120,6 +120,14 @@ struct __fn _CCCL_TEMPLATE(class _Tp) _CCCL_REQUIRES((!__member_begin<_Tp>) _CCCL_AND(!__unqualified_begin<_Tp>)) void operator()(_Tp&&) const = delete; + +# if _CCCL_COMPILER(MSVC, <, 19, 23) + template + void operator()(_Tp (&&)[]) const = delete; + + template + void operator()(_Tp (&&)[_Np]) const = delete; +# endif // _CCCL_COMPILER(MSVC, <, 19, 23) }; _LIBCUDACXX_END_NAMESPACE_CPO @@ -209,6 +217,14 @@ struct __fn _CCCL_TEMPLATE(class _Tp) _CCCL_REQUIRES((!__member_end<_Tp>) _CCCL_AND(!__unqualified_end<_Tp>)) void operator()(_Tp&&) const = delete; + +# if _CCCL_COMPILER(MSVC, <, 19, 23) + template + void operator()(_Tp (&&)[]) const = delete; + + template + void operator()(_Tp (&&)[_Np]) const = delete; +# endif // _CCCL_COMPILER(MSVC, <, 19, 23) }; _LIBCUDACXX_END_NAMESPACE_CPO @@ -279,7 +295,7 @@ inline namespace __cpo { _CCCL_GLOBAL_CONSTANT auto cend = __cend::__fn{}; } // namespace __cpo -#endif // _CCCL_STD_VER > 2014 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/concepts.h b/libcudacxx/include/cuda/std/__ranges/concepts.h index 4183f423ea6..dc4257e0818 100644 --- a/libcudacxx/include/cuda/std/__ranges/concepts.h +++ b/libcudacxx/include/cuda/std/__ranges/concepts.h @@ -44,7 +44,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 # if !defined(_CCCL_NO_CONCEPTS) @@ -142,19 +142,23 @@ concept viewable_range = # else // ^^^ !_CCCL_NO_CONCEPTS ^^^ / vvv _CCCL_NO_CONCEPTS vvv // [range.range] +// clang-format off template -_CCCL_CONCEPT_FRAGMENT( - __range_, - requires(_Tp& __t)(typename(decltype(_CUDA_VRANGES::begin(__t))), typename(decltype(_CUDA_VRANGES::end(__t))))); - -template -_CCCL_CONCEPT range = _CCCL_FRAGMENT(__range_, _Tp); +_CCCL_CONCEPT range = + _CCCL_REQUIRES_EXPR((_Tp), _Tp& __t) + ( + void(_CUDA_VRANGES::begin(__t)), + void(_CUDA_VRANGES::end(__t)) + ); template -_CCCL_CONCEPT_FRAGMENT(__input_range_, requires()(requires(range<_Tp>), requires(input_iterator>))); - -template -_CCCL_CONCEPT input_range = _CCCL_FRAGMENT(__input_range_, _Tp); +_CCCL_CONCEPT input_range = + _CCCL_REQUIRES_EXPR((_Tp)) + ( + requires(range<_Tp>), + requires(input_iterator>) + ); +// clang-format on template _CCCL_CONCEPT_FRAGMENT( @@ -302,7 +306,7 @@ template _CCCL_CONCEPT __container_compatible_range = _CCCL_FRAGMENT(__container_compatible_range_, _Range, _Tp); # endif // _CCCL_NO_CONCEPTS -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/dangling.h b/libcudacxx/include/cuda/std/__ranges/dangling.h index b97e5e5555a..7e99382cb3a 100644 --- a/libcudacxx/include/cuda/std/__ranges/dangling.h +++ b/libcudacxx/include/cuda/std/__ranges/dangling.h @@ -27,7 +27,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 struct dangling { @@ -47,7 +47,7 @@ using borrowed_iterator_t = enable_if_t, _If, ite // borrowed_subrange_t defined in <__ranges/subrange.h> -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/data.h b/libcudacxx/include/cuda/std/__ranges/data.h index 0f756d52a9f..a9c5db6f085 100644 --- a/libcudacxx/include/cuda/std/__ranges/data.h +++ b/libcudacxx/include/cuda/std/__ranges/data.h @@ -34,7 +34,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 // [range.prim.data] @@ -128,7 +128,7 @@ inline namespace __cpo _CCCL_GLOBAL_CONSTANT auto cdata = __cdata::__fn{}; } // namespace __cpo -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/enable_borrowed_range.h b/libcudacxx/include/cuda/std/__ranges/enable_borrowed_range.h index f0c9a58e679..79d6c23b8da 100644 --- a/libcudacxx/include/cuda/std/__ranges/enable_borrowed_range.h +++ b/libcudacxx/include/cuda/std/__ranges/enable_borrowed_range.h @@ -25,7 +25,7 @@ # pragma system_header #endif // no system header -#if _CCCL_STD_VER > 2014 +#if _CCCL_STD_VER >= 2014 _LIBCUDACXX_BEGIN_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/enable_view.h b/libcudacxx/include/cuda/std/__ranges/enable_view.h index 72e390c0499..315319387d2 100644 --- a/libcudacxx/include/cuda/std/__ranges/enable_view.h +++ b/libcudacxx/include/cuda/std/__ranges/enable_view.h @@ -30,7 +30,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER >= 2017 +#if _CCCL_STD_VER >= 2014 struct view_base {}; @@ -74,7 +74,7 @@ _CCCL_INLINE_VAR constexpr bool true; # endif // _CCCL_NO_CONCEPTS -#endif // _CCCL_STD_VER >= 2017 +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/size.h b/libcudacxx/include/cuda/std/__ranges/size.h index 0b432ae6e87..92d41a62052 100644 --- a/libcudacxx/include/cuda/std/__ranges/size.h +++ b/libcudacxx/include/cuda/std/__ranges/size.h @@ -36,7 +36,7 @@ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 template _CCCL_INLINE_VAR constexpr bool disable_sized_range = false; @@ -182,15 +182,8 @@ struct __fn noexcept(noexcept(_CUDA_VRANGES::size(__t))) { using _Signed = make_signed_t; - if constexpr (sizeof(ptrdiff_t) > sizeof(_Signed)) - { - return static_cast(_CUDA_VRANGES::size(__t)); - } - else - { - return static_cast<_Signed>(_CUDA_VRANGES::size(__t)); - } - _CCCL_UNREACHABLE(); + using _Result = conditional_t<(sizeof(ptrdiff_t) > sizeof(_Signed)), ptrdiff_t, _Signed>; + return static_cast<_Result>(_CUDA_VRANGES::size(__t)); } }; _LIBCUDACXX_END_NAMESPACE_CPO @@ -200,7 +193,7 @@ inline namespace __cpo _CCCL_GLOBAL_CONSTANT auto ssize = __ssize::__fn{}; } // namespace __cpo -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 _LIBCUDACXX_END_NAMESPACE_RANGES diff --git a/libcudacxx/include/cuda/std/__ranges/views.h b/libcudacxx/include/cuda/std/__ranges/views.h index 3954877f117..7dae143e8b2 100644 --- a/libcudacxx/include/cuda/std/__ranges/views.h +++ b/libcudacxx/include/cuda/std/__ranges/views.h @@ -21,7 +21,7 @@ # pragma system_header #endif // no system header -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 _LIBCUDACXX_BEGIN_NAMESPACE_VIEWS @@ -29,10 +29,10 @@ _LIBCUDACXX_END_NAMESPACE_VIEWS _LIBCUDACXX_BEGIN_NAMESPACE_STD -namespace views = ranges::views; +namespace views = ranges::views; // NOLINT: misc-unused-alias-decls _LIBCUDACXX_END_NAMESPACE_STD -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 #endif // _LIBCUDACXX___RANGES_VIEWS diff --git a/libcudacxx/include/cuda/std/__type_traits/common_reference.h b/libcudacxx/include/cuda/std/__type_traits/common_reference.h index 6f62a1033ef..7db241807eb 100644 --- a/libcudacxx/include/cuda/std/__type_traits/common_reference.h +++ b/libcudacxx/include/cuda/std/__type_traits/common_reference.h @@ -37,6 +37,8 @@ #include #include +_CCCL_NV_DIAG_SUPPRESS(1384) // warning: pointer converted to bool + _LIBCUDACXX_BEGIN_NAMESPACE_STD // common_reference @@ -253,4 +255,6 @@ struct common_reference _LIBCUDACXX_END_NAMESPACE_STD +_CCCL_NV_DIAG_DEFAULT(1384) + #endif // _LIBCUDACXX___TYPE_TRAITS_COMMON_REFERENCE_H diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/span b/libcudacxx/include/cuda/std/detail/libcxx/include/span index 042d2f029c5..19fdea2f4ce 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/span +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/span @@ -203,18 +203,7 @@ _CCCL_INLINE_VAR constexpr bool __is_std_span> = true; template _CCCL_CONCEPT __span_array_convertible = _CCCL_TRAIT(is_convertible, _From (*)[], _To (*)[]); -template -_CCCL_INLINE_VAR constexpr bool __is_std_initializer_list = false; - -template -_CCCL_INLINE_VAR constexpr bool __is_std_initializer_list> = true; - -// We want to ensure that span interacts nicely with containers that might not have had the ranges treatment -# if defined(__cpp_lib_ranges) && !_CCCL_COMPILER(MSVC2017) -# define _CCCL_SPAN_USES_RANGES -# endif // __cpp_lib_ranges && !_CCCL_COMPILER(MSVC2017) - -# if defined(_CCCL_SPAN_USES_RANGES) +# if !_CCCL_COMPILER(MSVC2017) template _CCCL_CONCEPT_FRAGMENT( __span_compatible_range_, @@ -223,15 +212,43 @@ _CCCL_CONCEPT_FRAGMENT( requires(_CUDA_VRANGES::sized_range<_Range>), requires((_CUDA_VRANGES::borrowed_range<_Range> || _CCCL_TRAIT(is_const, _ElementType))), requires((!_CCCL_TRAIT(is_array, remove_cvref_t<_Range>))), - requires((!__is_std_span> && !__is_std_array> - && !__is_std_initializer_list>) ), + requires((!__is_std_span> && !__is_std_array>) ), requires(_CCCL_TRAIT( is_convertible, remove_reference_t<_CUDA_VRANGES::range_reference_t<_Range>> (*)[], _ElementType (*)[])))); template _CCCL_CONCEPT __span_compatible_range = _CCCL_FRAGMENT(__span_compatible_range_, _Range, _ElementType); -# if _CCCL_STD_VER >= 2020 +# else // // ^^^ !_CCCL_COMPILER(MSVC2017) ^^^ / vvv _CCCL_COMPILER(MSVC2017) vvv + +template +_CCCL_INLINE_VAR constexpr bool __span_compatible_range = false; + +template +_CCCL_INLINE_VAR constexpr bool __span_compatible_range< + _Range, + _ElementType, + void_t< + // // is a contiguous range + // enable_if_t<_CUDA_VRANGES::contiguous_range<_Range>, nullptr_t>, + // // is a sized range + // enable_if_t<_CUDA_VRANGES::sized_range<_Range>, nullptr_t>, + // // is a borrowed range or ElementType is const + // enable_if_t<(_CUDA_VRANGES::borrowed_range<_Range> || _CCCL_TRAIT(is_const, _ElementType)), nullptr_t>, + // is not a C-style array + enable_if_t), nullptr_t>, + // is not a specialization of span + enable_if_t>, nullptr_t>, + // is not a specialization of array + enable_if_t>, nullptr_t>, + // remove_pointer_t(*)[] is convertible to ElementType(*)[] + enable_if_t<_CCCL_TRAIT(is_convertible, + remove_pointer_t()))> (*)[], + _ElementType (*)[]), + nullptr_t>>> = true; +# endif // _CCCL_COMPILER(MSVC2017) + +# if _CCCL_STD_VER >= 2020 template _CCCL_CONCEPT __span_compatible_iterator = contiguous_iterator<_It> && __span_array_convertible>, _Tp>; @@ -239,7 +256,7 @@ _CCCL_CONCEPT __span_compatible_iterator = template _CCCL_CONCEPT __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !_CCCL_TRAIT(is_convertible, _Sentinel, size_t); -# else // ^^^ C++20 ^^^ / vvv C++17 vvv +# else // ^^^ C++20 ^^^ / vvv C++17 vvv template _CCCL_CONCEPT_FRAGMENT(__span_compatible_iterator_, requires()(requires(contiguous_iterator<_It>), @@ -255,33 +272,7 @@ _CCCL_CONCEPT_FRAGMENT( template _CCCL_CONCEPT __span_compatible_sentinel_for = _CCCL_FRAGMENT(__span_compatible_sentinel_for_, _Sentinel, _It); -# endif // _CCCL_STD_VER <= 2017 -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - -template -_CCCL_INLINE_VAR constexpr bool __is_span_compatible_container = false; - -template -_CCCL_INLINE_VAR constexpr bool __is_span_compatible_container< - _Container, - _ElementType, - void_t< - // is not a specialization of span - enable_if_t>, nullptr_t>, - // is not a specialization of array - enable_if_t>, nullptr_t>, - // is not a specialization of array - enable_if_t>, nullptr_t>, - // is_array_v is false, - enable_if_t), nullptr_t>, - // data(cont) and size(cont) are well formed - decltype(_CUDA_VSTD::data(_CUDA_VSTD::declval<_Container&>())), - decltype(_CUDA_VSTD::size(_CUDA_VSTD::declval<_Container&>())), - // remove_pointer_t(*)[] is convertible to ElementType(*)[] - enable_if_t()))> (*)[], - _ElementType (*)[]>::value, - nullptr_t>>> = true; -# endif // !_CCCL_SPAN_USES_RANGES +# endif // _CCCL_STD_VER <= 2017 # if _CCCL_STD_VER >= 2020 @@ -350,7 +341,6 @@ public: _CCCL_HIDE_FROM_ABI span(const span&) noexcept = default; _CCCL_HIDE_FROM_ABI span& operator=(const span&) noexcept = default; -# if defined(_CCCL_SPAN_USES_RANGES) _CCCL_TEMPLATE(class _It) _CCCL_REQUIRES(__span_compatible_iterator<_It, element_type>) _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit span(_It __first, size_type __count) @@ -370,20 +360,6 @@ public: _CCCL_ASSERT(__last - __first == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent"); } -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(pointer __ptr, size_type __count) - : __data_{__ptr} - { - (void) __count; - _CCCL_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); - } - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(pointer __f, pointer __l) - : __data_{__f} - { - (void) __l; - _CCCL_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); - } -# endif // !_CCCL_SPAN_USES_RANGES # if _CCCL_COMPILER(NVRTC) || _CCCL_COMPILER(MSVC2017) template = 0> @@ -408,7 +384,6 @@ public: : __data_{__arr.data()} {} -# if defined(_CCCL_SPAN_USES_RANGES) _CCCL_TEMPLATE(class _Range) _CCCL_REQUIRES(__span_compatible_range<_Range, element_type>) _LIBCUDACXX_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) @@ -416,23 +391,6 @@ public: { _CCCL_ASSERT(_CUDA_VRANGES::size(__r) == _Extent, "size mismatch in span's constructor (range)"); } -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - _CCCL_TEMPLATE(class _Container) - _CCCL_REQUIRES(__is_span_compatible_container<_Container, _Tp>) - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(_Container& __c) noexcept(noexcept(_CUDA_VSTD::data(__c))) - : __data_{_CUDA_VSTD::data(__c)} - { - _CCCL_ASSERT(_Extent == _CUDA_VSTD::size(__c), "size mismatch in span's constructor (other span)"); - } - - _CCCL_TEMPLATE(class _Container) - _CCCL_REQUIRES(__is_span_compatible_container<_Container, const _Tp>) - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(const _Container& __c) noexcept(noexcept(_CUDA_VSTD::data(__c))) - : __data_{_CUDA_VSTD::data(__c)} - { - _CCCL_ASSERT(_Extent == _CUDA_VSTD::size(__c), "size mismatch in span's constructor (other span)"); - } -# endif // !_CCCL_SPAN_USES_RANGES _CCCL_TEMPLATE(class _OtherElementType, size_t _Extent2 = _Extent) _CCCL_REQUIRES((_Extent2 != dynamic_extent) _CCCL_AND __span_array_convertible<_OtherElementType, element_type>) @@ -613,7 +571,6 @@ public: _CCCL_HIDE_FROM_ABI span(const span&) noexcept = default; _CCCL_HIDE_FROM_ABI span& operator=(const span&) noexcept = default; -# if defined(_CCCL_SPAN_USES_RANGES) _CCCL_TEMPLATE(class _It) _CCCL_REQUIRES(__span_compatible_iterator<_It, element_type>) _LIBCUDACXX_HIDE_FROM_ABI constexpr span(_It __first, size_type __count) @@ -630,17 +587,6 @@ public: _CCCL_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)"); } -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(pointer __ptr, size_type __count) - : __data_{__ptr} - , __size_{__count} - {} - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(pointer __f, pointer __l) - : __data_{__f} - , __size_{static_cast(__l - __f)} - {} -# endif // !_CCCL_SPAN_USES_RANGES - template _LIBCUDACXX_HIDE_FROM_ABI constexpr span(type_identity_t (&__arr)[_Sz]) noexcept : __data_{__arr} @@ -661,28 +607,12 @@ public: , __size_{_Sz} {} -# if defined(_CCCL_SPAN_USES_RANGES) _CCCL_TEMPLATE(class _Range) _CCCL_REQUIRES(__span_compatible_range<_Range, element_type>) _LIBCUDACXX_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(_CUDA_VRANGES::data(__r)) , __size_{_CUDA_VRANGES::size(__r)} {} -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - _CCCL_TEMPLATE(class _Container) - _CCCL_REQUIRES(__is_span_compatible_container<_Container, _Tp>) - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(_Container& __c) - : __data_{_CUDA_VSTD::data(__c)} - , __size_{(size_type) _CUDA_VSTD::size(__c)} - {} - - _CCCL_TEMPLATE(class _Container) - _CCCL_REQUIRES(__is_span_compatible_container<_Container, const _Tp>) - _LIBCUDACXX_HIDE_FROM_ABI constexpr span(const _Container& __c) - : __data_{_CUDA_VSTD::data(__c)} - , __size_{(size_type) _CUDA_VSTD::size(__c)} - {} -# endif // !_CCCL_SPAN_USES_RANGES _CCCL_TEMPLATE(class _OtherElementType, size_t _OtherExtent) _CCCL_REQUIRES(__span_array_convertible<_OtherElementType, element_type>) @@ -812,12 +742,12 @@ public: _LIBCUDACXX_HIDE_FROM_ABI span __as_bytes() const noexcept { - return {reinterpret_cast(data()), size_bytes()}; + return span{reinterpret_cast(data()), size_bytes()}; } _LIBCUDACXX_HIDE_FROM_ABI span __as_writable_bytes() const noexcept { - return {reinterpret_cast(data()), size_bytes()}; + return span{reinterpret_cast(data()), size_bytes()}; } private: @@ -853,8 +783,6 @@ _CCCL_HOST_DEVICE span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>; template _CCCL_HOST_DEVICE span(const array<_Tp, _Sz>&) -> span; -# if defined(_CCCL_SPAN_USES_RANGES) - _CCCL_TEMPLATE(class _It, class _EndOrSize) _CCCL_REQUIRES(contiguous_iterator<_It>) _CCCL_HOST_DEVICE span(_It, @@ -864,23 +792,11 @@ _CCCL_TEMPLATE(class _Range) _CCCL_REQUIRES(_CUDA_VRANGES::contiguous_range<_Range>) _CCCL_HOST_DEVICE span(_Range&&) -> span>>; -# else // ^^^ _CCCL_SPAN_USES_RANGES ^^^ / vvv !_CCCL_SPAN_USES_RANGES vvv - -_CCCL_TEMPLATE(class _Container) -_CCCL_REQUIRES(__is_span_compatible_container<_Container, typename _Container::value_type>) -_CCCL_HOST_DEVICE span(_Container&) -> span; - -_CCCL_TEMPLATE(class _Container) -_CCCL_REQUIRES(__is_span_compatible_container<_Container, const typename _Container::value_type>) -_CCCL_HOST_DEVICE span(const _Container&) -> span; - -# endif // !_CCCL_SPAN_USES_RANGES - #endif // _CCCL_STD_VER >= 2017 _LIBCUDACXX_END_NAMESPACE_STD -#if _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#if _CCCL_STD_VER >= 2014 && !_CCCL_COMPILER(MSVC2017) _LIBCUDACXX_BEGIN_NAMESPACE_RANGES template _CCCL_INLINE_VAR constexpr bool enable_borrowed_range> = true; @@ -888,6 +804,6 @@ _CCCL_INLINE_VAR constexpr bool enable_borrowed_range> = true template _CCCL_INLINE_VAR constexpr bool enable_view> = true; _LIBCUDACXX_END_NAMESPACE_RANGES -#endif // _CCCL_STD_VER >= 2017 && !_CCCL_COMPILER(MSVC2017) +#endif // _CCCL_STD_VER >= 2014 && !_CCCL_COMPILER(MSVC2017) #endif // _LIBCUDACXX_SPAN diff --git a/libcudacxx/test/libcudacxx/std/containers/views/views.span/enable_borrowed_range.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/containers/views/views.span/enable_borrowed_range.compile.pass.cpp index 93f9165ae59..81b36ef1d43 100644 --- a/libcudacxx/test/libcudacxx/std/containers/views/views.span/enable_borrowed_range.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/containers/views/views.span/enable_borrowed_range.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // UNSUPPORTED: msvc-19.16 // @@ -22,11 +22,11 @@ int main(int, char**) { - static_assert(cuda::std::ranges::enable_borrowed_range>); - static_assert(cuda::std::ranges::enable_borrowed_range>); - static_assert(cuda::std::ranges::enable_borrowed_range>); - static_assert(!cuda::std::ranges::enable_borrowed_range&>); - static_assert(!cuda::std::ranges::enable_borrowed_range const>); + static_assert(cuda::std::ranges::enable_borrowed_range>, ""); + static_assert(cuda::std::ranges::enable_borrowed_range>, ""); + static_assert(cuda::std::ranges::enable_borrowed_range>, ""); + static_assert(!cuda::std::ranges::enable_borrowed_range&>, ""); + static_assert(!cuda::std::ranges::enable_borrowed_range const>, ""); return 0; } diff --git a/libcudacxx/test/libcudacxx/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp index d0959bf08c3..08ba0d47aaa 100644 --- a/libcudacxx/test/libcudacxx/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // UNSUPPORTED: msvc-19.16 // span @@ -18,23 +18,23 @@ using range = cuda::std::span; -static_assert(cuda::std::same_as, range::iterator>); -static_assert(cuda::std::ranges::common_range); -static_assert(cuda::std::ranges::random_access_range); -static_assert(cuda::std::ranges::contiguous_range); -static_assert(cuda::std::ranges::view && cuda::std::ranges::enable_view); -static_assert(cuda::std::ranges::sized_range); -static_assert(cuda::std::ranges::borrowed_range); -static_assert(cuda::std::ranges::viewable_range); +static_assert(cuda::std::same_as, range::iterator>, ""); +static_assert(cuda::std::ranges::common_range, ""); +static_assert(cuda::std::ranges::random_access_range, ""); +static_assert(cuda::std::ranges::contiguous_range, ""); +static_assert(cuda::std::ranges::view && cuda::std::ranges::enable_view, ""); +static_assert(cuda::std::ranges::sized_range, ""); +static_assert(cuda::std::ranges::borrowed_range, ""); +static_assert(cuda::std::ranges::viewable_range, ""); -static_assert(cuda::std::same_as, range::iterator>); -static_assert(cuda::std::ranges::common_range); -static_assert(cuda::std::ranges::random_access_range); -static_assert(cuda::std::ranges::contiguous_range); -static_assert(!cuda::std::ranges::view && !cuda::std::ranges::enable_view); -static_assert(cuda::std::ranges::sized_range); -static_assert(cuda::std::ranges::borrowed_range); -static_assert(cuda::std::ranges::viewable_range); +static_assert(cuda::std::same_as, range::iterator>, ""); +static_assert(cuda::std::ranges::common_range, ""); +static_assert(cuda::std::ranges::random_access_range, ""); +static_assert(cuda::std::ranges::contiguous_range, ""); +static_assert(!cuda::std::ranges::view && !cuda::std::ranges::enable_view, ""); +static_assert(cuda::std::ranges::sized_range, ""); +static_assert(cuda::std::ranges::borrowed_range, ""); +static_assert(cuda::std::ranges::viewable_range, ""); int main(int, char**) { diff --git a/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/deduct.pass.cpp b/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/deduct.pass.cpp index 6f3434b5013..c6fe12b759b 100644 --- a/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/deduct.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/deduct.pass.cpp @@ -52,7 +52,6 @@ __host__ __device__ void test_iterator_sentinel() assert(s.data() == cuda::std::data(arr)); } -#if defined(_CCCL_SPAN_USES_RANGES) // P3029R1: deduction from `integral_constant` { cuda::std::span s{cuda::std::begin(arr), cuda::std::integral_constant{}}; @@ -60,7 +59,6 @@ __host__ __device__ void test_iterator_sentinel() assert(s.size() == cuda::std::size(arr)); assert(s.data() == cuda::std::data(arr)); } -#endif // _CCCL_SPAN_USES_RANGES } __host__ __device__ void test_c_array() diff --git a/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/initializer_list.pass.cpp b/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/initializer_list.pass.cpp index d84d0b01115..3f5990de3e8 100644 --- a/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/initializer_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/containers/views/views.span/span.cons/initializer_list.pass.cpp @@ -28,8 +28,8 @@ using cuda::std::is_constructible; // Constructor constrains static_assert(is_constructible, cuda::std::initializer_list>::value, ""); static_assert(is_constructible, cuda::std::initializer_list>::value, ""); -static_assert(!is_constructible, cuda::std::initializer_list>::value, ""); -static_assert(!is_constructible, cuda::std::initializer_list>::value, ""); +static_assert(is_constructible, cuda::std::initializer_list>::value, ""); +static_assert(is_constructible, cuda::std::initializer_list>::value, ""); static_assert(!is_constructible, cuda::std::initializer_list>::value, ""); static_assert(!is_constructible, cuda::std::initializer_list>::value, ""); diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp index 87bb2900fc8..1ce2ee9a691 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // template // struct iterator_traits; @@ -26,32 +26,33 @@ #include "test_macros.h" template -inline constexpr bool has_iterator_concept_v = false; +_CCCL_INLINE_VAR constexpr bool has_iterator_concept_v = false; template -inline constexpr bool has_iterator_concept_v> = true; +_CCCL_INLINE_VAR constexpr bool has_iterator_concept_v> = + true; template , int> = 0> __host__ __device__ constexpr void test_iter_concept() { - static_assert(cuda::std::same_as); + static_assert(cuda::std::same_as, ""); } template , int> = 0> __host__ __device__ constexpr void test_iter_concept() { - static_assert(!has_iterator_concept_v); + static_assert(!has_iterator_concept_v, ""); } template __host__ __device__ constexpr bool test() { using Traits = cuda::std::iterator_traits; - static_assert(cuda::std::same_as); - static_assert(cuda::std::same_as); - static_assert(cuda::std::same_as); - static_assert(cuda::std::same_as); - static_assert(cuda::std::same_as); + static_assert(cuda::std::same_as, ""); + static_assert(cuda::std::same_as, ""); + static_assert(cuda::std::same_as, ""); + static_assert(cuda::std::same_as, ""); + static_assert(cuda::std::same_as, ""); test_iter_concept(); @@ -82,8 +83,8 @@ __host__ __device__ constexpr bool testMutable() // exists for any particular non-pointer type, we assume it is present // only for pointers. // -static_assert(testMutable::iterator, cuda::std::random_access_iterator_tag, int>()); -static_assert(testConst::const_iterator, cuda::std::random_access_iterator_tag, int>()); +static_assert(testMutable::iterator, cuda::std::random_access_iterator_tag, int>(), ""); +static_assert(testConst::const_iterator, cuda::std::random_access_iterator_tag, int>(), ""); // Local test iterators. @@ -101,12 +102,12 @@ struct AllMembers {}; }; using AllMembersTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct NoPointerMember { @@ -122,12 +123,12 @@ struct NoPointerMember __host__ __device__ value_type* operator->() const; }; using NoPointerMemberTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct IterConcept { @@ -146,12 +147,12 @@ struct IterConcept {}; }; using IterConceptTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyInput { @@ -178,12 +179,12 @@ struct cuda::std::incrementable_traits using difference_type = short; }; using LegacyInputTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyInputNoValueType { @@ -209,12 +210,12 @@ struct cuda::std::indirectly_readable_traits using value_type = LegacyInputNoValueType::not_value_type; }; using LegacyInputNoValueTypeTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyForward { @@ -240,12 +241,12 @@ struct cuda::std::incrementable_traits using difference_type = short; // or any signed integral type }; using LegacyForwardTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyBidirectional { @@ -264,12 +265,13 @@ struct LegacyBidirectional __host__ __device__ friend short operator-(LegacyBidirectional, LegacyBidirectional); }; using LegacyBidirectionalTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, + ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); // Almost a random access iterator except it is missing operator-(It, It). struct MinusNotDeclaredIter @@ -326,12 +328,13 @@ struct cuda::std::incrementable_traits using difference_type = short; }; using MinusNotDeclaredIterTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, + ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct WrongSubscriptReturnType { @@ -383,12 +386,12 @@ struct WrongSubscriptReturnType }; using WrongSubscriptReturnTypeTraits = cuda::std::iterator_traits; static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyRandomAccess { @@ -417,12 +420,13 @@ struct LegacyRandomAccess __host__ __device__ friend LegacyRandomAccess operator+(int, LegacyRandomAccess); }; using LegacyRandomAccessTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, + ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyRandomAccessSpaceship { @@ -493,14 +497,14 @@ struct cuda::std::incrementable_traits }; using LegacyRandomAccessSpaceshipTraits = cuda::std::iterator_traits; static_assert( - cuda::std::same_as); + cuda::std::same_as, ""); static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); // For output iterators, value_type, difference_type, and reference may be void. struct BareLegacyOutput @@ -512,12 +516,12 @@ struct BareLegacyOutput __host__ __device__ BareLegacyOutput operator++(int); }; using BareLegacyOutputTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); // The operator- means we get difference_type. struct LegacyOutputWithMinus @@ -531,12 +535,12 @@ struct LegacyOutputWithMinus // Lacking operator==, this is a LegacyIterator but not a LegacyInputIterator. }; using LegacyOutputWithMinusTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyOutputWithMemberTypes { @@ -557,12 +561,13 @@ struct LegacyOutputWithMemberTypes // Since (*it) is not convertible to value_type, this is not a LegacyInputIterator. }; using LegacyOutputWithMemberTypesTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, + ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); struct LegacyRandomAccessSpecialized { @@ -628,88 +633,89 @@ struct cuda::std::iterator_traits }; using LegacyRandomAccessSpecializedTraits = cuda::std::iterator_traits; static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); // Other test iterators. using InputTestIteratorTraits = cuda::std::iterator_traits>; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using OutputTestIteratorTraits = cuda::std::iterator_traits>; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using ForwardTestIteratorTraits = cuda::std::iterator_traits>; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using BidirectionalTestIteratorTraits = cuda::std::iterator_traits>; static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using RandomAccessTestIteratorTraits = cuda::std::iterator_traits>; static_assert( - cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); + cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using ContiguousTestIteratorTraits = cuda::std::iterator_traits>; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, + ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using Cpp17BasicIteratorTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using Cpp17InputIteratorTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); using Cpp17ForwardIteratorTraits = cuda::std::iterator_traits; -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(cuda::std::same_as); -static_assert(!has_iterator_concept_v); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(cuda::std::same_as, ""); +static_assert(!has_iterator_concept_v, ""); int main(int, char**) { diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/iter_reference_t.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/iter_reference_t.compile.pass.cpp index c5f0a019c70..cfb7dfc6c2b 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/iter_reference_t.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/iterator.traits/iter_reference_t.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // template // using iter_reference_t = decltype(*declval()); @@ -17,10 +17,10 @@ #include "test_iterators.h" -static_assert(cuda::std::same_as>, int&>); -static_assert(cuda::std::same_as>, int&>); -static_assert(cuda::std::same_as>, int&>); -static_assert(cuda::std::same_as>, int&>); +static_assert(cuda::std::same_as>, int&>, ""); +static_assert(cuda::std::same_as>, int&>, ""); +static_assert(cuda::std::same_as>, int&>, ""); +static_assert(cuda::std::same_as>, int&>, ""); int main(int, char**) { diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/std.iterator.tags/contiguous_iterator_tag.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/std.iterator.tags/contiguous_iterator_tag.pass.cpp index e57be04cd55..c5764895b62 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/std.iterator.tags/contiguous_iterator_tag.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.primitives/std.iterator.tags/contiguous_iterator_tag.pass.cpp @@ -11,7 +11,7 @@ // struct contiguous_iterator_tag : public random_access_iterator_tag {}; -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 #include #include @@ -23,8 +23,9 @@ int main(int, char**) cuda::std::contiguous_iterator_tag tag; ((void) tag); // Prevent unused warning static_assert( - (cuda::std::is_base_of::value)); - static_assert((!cuda::std::is_base_of::value)); + (cuda::std::is_base_of::value), ""); + static_assert((!cuda::std::is_base_of::value), + ""); return 0; } diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.compile.pass.cpp index 8f1a6b608e6..3f89e8b84fc 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // template // concept indirectly_copyable; @@ -29,43 +29,43 @@ struct CopyOnly }; // Can copy the underlying objects between pointers. -static_assert(cuda::std::indirectly_copyable); -static_assert(cuda::std::indirectly_copyable); +static_assert(cuda::std::indirectly_copyable, ""); +static_assert(cuda::std::indirectly_copyable, ""); // Can't copy if the output pointer is const. -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); // Can copy from a pointer into an array but arrays aren't considered indirectly copyable-from. -static_assert(cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); +static_assert(cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); // Can't copy between non-pointer types. -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); // Check some less common types. -static_assert(!cuda::std::indirectly_movable); -static_assert(!cuda::std::indirectly_movable); -static_assert(!cuda::std::indirectly_movable); -static_assert(!cuda::std::indirectly_movable); -static_assert(!cuda::std::indirectly_movable); +static_assert(!cuda::std::indirectly_movable, ""); +static_assert(!cuda::std::indirectly_movable, ""); +static_assert(!cuda::std::indirectly_movable, ""); +static_assert(!cuda::std::indirectly_movable, ""); +static_assert(!cuda::std::indirectly_movable, ""); // Can't copy move-only objects. -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); // Can copy copy-only objects. #ifndef TEST_COMPILER_MSVC_2017 // MSVC2017 has issues determining common_reference -static_assert(cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); -static_assert(cuda::std::indirectly_copyable); -static_assert(!cuda::std::indirectly_copyable); +static_assert(cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); +static_assert(cuda::std::indirectly_copyable, ""); +static_assert(!cuda::std::indirectly_copyable, ""); #endif // TEST_COMPILER_MSVC_2017 template @@ -77,13 +77,13 @@ struct PointerTo #ifndef TEST_COMPILER_MSVC_2017 // MSVC2017 has issues determining common_reference // Can copy through a dereferenceable class. -static_assert(cuda::std::indirectly_copyable>); -static_assert(!cuda::std::indirectly_copyable>); -static_assert(cuda::std::indirectly_copyable, PointerTo>); -static_assert(!cuda::std::indirectly_copyable, PointerTo>); -static_assert(cuda::std::indirectly_copyable>); -static_assert(cuda::std::indirectly_copyable, CopyOnly*>); -static_assert(cuda::std::indirectly_copyable, PointerTo>); +static_assert(cuda::std::indirectly_copyable>, ""); +static_assert(!cuda::std::indirectly_copyable>, ""); +static_assert(cuda::std::indirectly_copyable, PointerTo>, ""); +static_assert(!cuda::std::indirectly_copyable, PointerTo>, ""); +static_assert(cuda::std::indirectly_copyable>, ""); +static_assert(cuda::std::indirectly_copyable, CopyOnly*>, ""); +static_assert(cuda::std::indirectly_copyable, PointerTo>, ""); #endif // TEST_COMPILER_MSVC_2017 int main(int, char**) diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.subsumption.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.subsumption.compile.pass.cpp index 3f862c463e4..dc97f45d014 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.subsumption.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable.subsumption.compile.pass.cpp @@ -29,7 +29,7 @@ __host__ __device__ constexpr bool indirectly_copyable_subsumption() return true; } -static_assert(indirectly_copyable_subsumption()); +static_assert(indirectly_copyable_subsumption(), ""); int main(int, char**) { diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable_storable.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable_storable.compile.pass.cpp index dc63264f480..33d6ed0477f 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable_storable.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/alg.req.ind.copy/indirectly_copyable_storable.compile.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11 // template // concept indirectly_copyable_storable; @@ -35,17 +35,17 @@ struct PointerTo // Copying the underlying object between pointers (or dereferenceable classes) works. This is a non-exhaustive check // because this functionality comes from `indirectly_copyable`. -static_assert(cuda::std::indirectly_copyable_storable); -static_assert(cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable, PointerTo>); +static_assert(cuda::std::indirectly_copyable_storable, ""); +static_assert(cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, PointerTo>, ""); // `indirectly_copyable_storable` requires the type to be `copyable`, which in turns requires it to be `movable`. -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable, PointerTo>); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, PointerTo>, ""); // The dereference operator returns a different type from `value_type` and the reference type cannot be assigned from a // non-const lvalue of `ValueType` (but all other forms of assignment from `ValueType` work). @@ -70,12 +70,14 @@ struct NoLvalueAssignment __host__ __device__ ReferenceType& operator*() const; }; -static_assert(cuda::std::indirectly_writable>); -static_assert(!cuda::std::indirectly_writable&>); -static_assert(cuda::std::indirectly_writable&>); -static_assert(cuda::std::indirectly_writable&&>); -static_assert(cuda::std::indirectly_writable&&>); -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(cuda::std::indirectly_writable>, ""); +static_assert(!cuda::std::indirectly_writable&>, ""); +static_assert(cuda::std::indirectly_writable&>, + ""); +static_assert(cuda::std::indirectly_writable&&>, ""); +static_assert(cuda::std::indirectly_writable&&>, + ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); // The dereference operator returns a different type from `value_type` and the reference type cannot be assigned from a // const lvalue of `ValueType` (but all other forms of assignment from `ValueType` work). @@ -101,16 +103,18 @@ struct NoConstLvalueAssignment }; static_assert( - cuda::std::indirectly_writable>); + cuda::std::indirectly_writable>, ""); static_assert( - cuda::std::indirectly_writable&>); + cuda::std::indirectly_writable&>, ""); static_assert( - !cuda::std::indirectly_writable&>); + !cuda::std::indirectly_writable&>, + ""); static_assert( - cuda::std::indirectly_writable&&>); + cuda::std::indirectly_writable&&>, ""); static_assert( - cuda::std::indirectly_writable&&>); -static_assert(!cuda::std::indirectly_copyable_storable); + cuda::std::indirectly_writable&&>, + ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); // The dereference operator returns a different type from `value_type` and the reference type cannot be assigned from a // non-const rvalue of `ValueType` (but all other forms of assignment from `ValueType` work). @@ -135,12 +139,14 @@ struct NoRvalueAssignment __host__ __device__ ReferenceType& operator*() const; }; -static_assert(cuda::std::indirectly_writable>); -static_assert(cuda::std::indirectly_writable&>); -static_assert(cuda::std::indirectly_writable&>); -static_assert(!cuda::std::indirectly_writable&&>); -static_assert(cuda::std::indirectly_writable&&>); -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(cuda::std::indirectly_writable>, ""); +static_assert(cuda::std::indirectly_writable&>, ""); +static_assert(cuda::std::indirectly_writable&>, + ""); +static_assert(!cuda::std::indirectly_writable&&>, ""); +static_assert(cuda::std::indirectly_writable&&>, + ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); // The dereference operator returns a different type from `value_type` and the reference type cannot be assigned from a // const rvalue of `ValueType` (but all other forms of assignment from `ValueType` work). @@ -166,16 +172,17 @@ struct NoConstRvalueAssignment }; static_assert( - cuda::std::indirectly_writable>); + cuda::std::indirectly_writable>, ""); static_assert( - cuda::std::indirectly_writable&>); + cuda::std::indirectly_writable&>, ""); static_assert( - cuda::std::indirectly_writable&>); + cuda::std::indirectly_writable&>, ""); static_assert( - cuda::std::indirectly_writable&&>); + cuda::std::indirectly_writable&&>, ""); static_assert( - !cuda::std::indirectly_writable&&>); -static_assert(!cuda::std::indirectly_copyable_storable); + !cuda::std::indirectly_writable&&>, + ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); struct DeletedCopyCtor { @@ -191,7 +198,7 @@ struct DeletedNonconstCopyCtor DeletedNonconstCopyCtor(DeletedNonconstCopyCtor&) = delete; DeletedNonconstCopyCtor& operator=(DeletedNonconstCopyCtor const&) = default; }; -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(!cuda::std::indirectly_copyable_storable, ""); #endif // TEST_STD_VER > 2017 || !defined(TEST_COMPILER_MSVC) struct DeletedMoveCtor @@ -208,7 +215,7 @@ struct DeletedConstMoveCtor DeletedConstMoveCtor(DeletedConstMoveCtor const&&) = delete; DeletedConstMoveCtor& operator=(DeletedConstMoveCtor&&) = default; }; -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(!cuda::std::indirectly_copyable_storable, ""); #endif // TEST_STD_VER > 2017 || !defined(TEST_COMPILER_MSVC) struct DeletedCopyAssignment @@ -225,7 +232,8 @@ struct DeletedNonconstCopyAssignment DeletedNonconstCopyAssignment& operator=(DeletedNonconstCopyAssignment const&) = default; DeletedNonconstCopyAssignment& operator=(DeletedNonconstCopyAssignment&) = delete; }; -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(!cuda::std::indirectly_copyable_storable, + ""); #endif // TEST_STD_VER > 2017 || !defined(TEST_COMPILER_MSVC) struct DeletedMoveAssignment @@ -240,11 +248,11 @@ struct DeletedConstMoveAssignment DeletedConstMoveAssignment& operator=(DeletedConstMoveAssignment&&) = delete; }; -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); -static_assert(!cuda::std::indirectly_copyable_storable); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); +static_assert(!cuda::std::indirectly_copyable_storable, ""); struct InconsistentIterator { @@ -267,7 +275,7 @@ struct InconsistentIterator // `ValueType` can be constructed with a `ReferenceType` and assigned to a `ReferenceType`, so it does model // `indirectly_copyable_storable`. -static_assert(cuda::std::indirectly_copyable_storable); +static_assert(cuda::std::indirectly_copyable_storable, ""); struct CommonType {}; @@ -292,22 +300,27 @@ struct NotConstructibleFromRefIn __host__ __device__ ReferenceType& operator*() const; }; +namespace cuda +{ +namespace std +{ template