From c50a8f41634e6080f2a65d3d33e6c9afdf314e4f Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Thu, 27 Feb 2025 11:23:58 +0100 Subject: [PATCH] Use `_CCCL_REQUIRES_EXPR` in test code --- .../default_initializable.verify.cpp | 5 +--- .../indirect_result_t.compile.pass.cpp | 11 ++------ .../projected/projected.compile.pass.cpp | 10 +------ .../incrementable_traits.compile.pass.cpp | 27 ++++--------------- ...ndirectly_readable_traits.compile.pass.cpp | 27 ++++--------------- .../iter_common_reference_t.compile.pass.cpp | 9 +------ .../sized_sentinel.compile.pass.cpp | 10 +------ .../range.ref.view/range.ref.view.pass.cpp | 23 +++------------- .../assign/emplace.intializer_list.pass.cpp | 5 ++-- .../expected.expected/assign/emplace.pass.cpp | 5 ++-- .../ctor/ctor.inplace.pass.cpp | 7 ++--- .../ctor/ctor.inplace_init_list.pass.cpp | 7 ++--- .../ctor/ctor.unexpect.pass.cpp | 7 ++--- .../ctor/ctor.unexpect_init_list.pass.cpp | 7 ++--- .../swap/member.swap.pass.cpp | 5 ++-- .../ctor/ctor.inplace.pass.cpp | 7 ++--- .../ctor/ctor.inplace_init_list.pass.cpp | 7 ++--- .../expected.void/ctor/ctor.unexpect.pass.cpp | 7 ++--- .../ctor/ctor.unexpect_init_list.pass.cpp | 7 ++--- .../expected.void/swap/member.swap.pass.cpp | 6 ++--- .../make_unique_for_overwrite.pass.cpp | 7 ++--- .../optional.monadic/or_else.pass.cpp | 18 ++----------- 22 files changed, 47 insertions(+), 177 deletions(-) diff --git a/libcudacxx/test/libcudacxx/std/concepts/concepts.lang/concept.default.init/default_initializable.verify.cpp b/libcudacxx/test/libcudacxx/std/concepts/concepts.lang/concept.default.init/default_initializable.verify.cpp index cd63e70aa8c..1f1a4fb859f 100644 --- a/libcudacxx/test/libcudacxx/std/concepts/concepts.lang/concept.default.init/default_initializable.verify.cpp +++ b/libcudacxx/test/libcudacxx/std/concepts/concepts.lang/concept.default.init/default_initializable.verify.cpp @@ -18,10 +18,7 @@ #include "test_macros.h" template -_CCCL_CONCEPT_FRAGMENT(brace_initializable_, requires()(T{})); - -template -_CCCL_CONCEPT brace_initializable = _CCCL_FRAGMENT(brace_initializable_, T); +_CCCL_CONCEPT brace_initializable = _CCCL_REQUIRES_EXPR((T))((T{})); __host__ __device__ void test() { diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_result_t.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_result_t.compile.pass.cpp index b1c762a2960..daab060c485 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_result_t.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirect_result_t.compile.pass.cpp @@ -23,16 +23,9 @@ static_assert(cuda::std::same_as, lo static_assert(cuda::std::same_as, S&&>, ""); static_assert(cuda::std::same_as, int S::*>, ""); -#if TEST_STD_VER > 2017 template -constexpr bool has_indirect_result = requires { typename cuda::std::indirect_result_t; }; -#else -template -_CCCL_CONCEPT_FRAGMENT(has_indirect_result_, requires()(typename(cuda::std::indirect_result_t))); - -template -_CCCL_CONCEPT has_indirect_result = _CCCL_FRAGMENT(has_indirect_result_, F, Is...); -#endif +_CCCL_CONCEPT has_indirect_result = + _CCCL_REQUIRES_EXPR((F, variadic Is))(typename(cuda::std::indirect_result_t)); static_assert(!has_indirect_result, ""); // int isn't indirectly_readable static_assert(!has_indirect_result, ""); // int isn't invocable diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/projected/projected.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/projected/projected.compile.pass.cpp index 4e884c849c6..12ce0e3755c 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/projected/projected.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/indirectcallable/projected/projected.compile.pass.cpp @@ -53,16 +53,8 @@ static_assert(cuda::std::same_as, ""); static_assert(cuda::std::same_as()), S&>, ""); static_assert(cuda::std::same_as, cuda::std::ptrdiff_t>, ""); -#if TEST_STD_VER > 2017 template -constexpr bool projectable = requires { typename cuda::std::projected; }; -#else -template -_CCCL_CONCEPT_FRAGMENT(projectable_, requires()(typename(cuda::std::projected))); - -template -_CCCL_CONCEPT projectable = _CCCL_FRAGMENT(projectable_, I, F); -#endif +_CCCL_CONCEPT projectable = _CCCL_REQUIRES_EXPR((I, F))(typename(cuda::std::projected)); static_assert(!projectable, ""); // int isn't indirectly_readable static_assert(!projectable, ""); // S isn't weakly_incrementable diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp index 27bcaac9c27..07bf8ebf916 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp @@ -15,31 +15,14 @@ #include "test_macros.h" -#if TEST_STD_VER > 2017 template -concept check_has_difference_type = requires { typename cuda::std::incrementable_traits::difference_type; }; +_CCCL_CONCEPT check_has_difference_type = + _CCCL_REQUIRES_EXPR((T))(typename(typename cuda::std::incrementable_traits::difference_type)); template -concept check_difference_type_matches = - check_has_difference_type - && cuda::std::same_as::difference_type, Expected>; -#else -template -_CCCL_INLINE_VAR constexpr bool check_has_difference_type = false; - -template -_CCCL_INLINE_VAR constexpr bool - check_has_difference_type::difference_type>> = true; - -template -_CCCL_CONCEPT_FRAGMENT( - check_difference_type_matches_, - requires()(requires(check_has_difference_type), - requires(cuda::std::same_as::difference_type, Expected>))); - -template -_CCCL_CONCEPT check_difference_type_matches = _CCCL_FRAGMENT(check_difference_type_matches_, T, Expected); -#endif +_CCCL_CONCEPT check_difference_type_matches = _CCCL_REQUIRES_EXPR( + (T, Expected))(requires(check_has_difference_type), + requires(cuda::std::same_as::difference_type, Expected>)); template __host__ __device__ constexpr bool check_incrementable_traits() diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp index ee901de1f28..a1973e46b6d 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp @@ -13,31 +13,14 @@ #include #include -#if TEST_STD_VER > 2017 template -concept has_no_value_type = !requires { typename cuda::std::indirectly_readable_traits::value_type; }; +_CCCL_CONCEPT has_no_value_type = + !_CCCL_REQUIRES_EXPR((T))(typename(typename cuda::std::indirectly_readable_traits::value_type)); template -concept value_type_matches = - cuda::std::same_as::value_type, Expected>; - -#else -template -_CCCL_CONCEPT_FRAGMENT(has_no_value_type_, - requires()(typename(typename cuda::std::indirectly_readable_traits::value_type))); - -template -_CCCL_CONCEPT has_no_value_type = !_CCCL_FRAGMENT(has_no_value_type_, T); - -template -_CCCL_CONCEPT_FRAGMENT( - value_type_matches_, - requires()(typename(typename cuda::std::indirectly_readable_traits::value_type), - requires(cuda::std::same_as::value_type, Expected>))); - -template -_CCCL_CONCEPT value_type_matches = _CCCL_FRAGMENT(value_type_matches_, T, Expected); -#endif +_CCCL_CONCEPT value_type_matches = _CCCL_REQUIRES_EXPR( + (T, Expected))(typename(typename cuda::std::indirectly_readable_traits::value_type), + requires(cuda::std::same_as::value_type, Expected>)); template __host__ __device__ constexpr bool check_pointer() diff --git a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/iter_common_reference_t.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/iter_common_reference_t.compile.pass.cpp index f1074fbffbb..4add027ef85 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/iter_common_reference_t.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/iter_common_reference_t.compile.pass.cpp @@ -65,16 +65,9 @@ struct T3 static_assert(cuda::std::same_as, Common>, ""); // Make sure we're SFINAE-friendly -#if TEST_STD_VER > 2017 template -constexpr bool has_common_reference = requires { typename cuda::std::iter_common_reference_t; }; -#else -template -_CCCL_CONCEPT_FRAGMENT(has_common_reference_, requires()(typename(cuda::std::iter_common_reference_t))); +_CCCL_CONCEPT has_common_reference = _CCCL_REQUIRES_EXPR((T))(typename(cuda::std::iter_common_reference_t)); -template -_CCCL_CONCEPT has_common_reference = _CCCL_FRAGMENT(has_common_reference_, T); -#endif struct NotIndirectlyReadable {}; static_assert(!has_common_reference, ""); diff --git a/libcudacxx/test/libcudacxx/std/iterators/predef.iterators/reverse.iterators/sized_sentinel.compile.pass.cpp b/libcudacxx/test/libcudacxx/std/iterators/predef.iterators/reverse.iterators/sized_sentinel.compile.pass.cpp index 15718a13bf7..d79796e50d1 100644 --- a/libcudacxx/test/libcudacxx/std/iterators/predef.iterators/reverse.iterators/sized_sentinel.compile.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/iterators/predef.iterators/reverse.iterators/sized_sentinel.compile.pass.cpp @@ -14,16 +14,8 @@ #include "test_iterators.h" #include "test_macros.h" -#if TEST_STD_VER > 2017 template -concept HasMinus = requires(T t) { t - t; }; -#else -template -_CCCL_CONCEPT_FRAGMENT(HasMinus_, requires(T t)(t - t)); - -template -_CCCL_CONCEPT HasMinus = _CCCL_FRAGMENT(HasMinus_, T); -#endif +_CCCL_CONCEPT HasMinus = _CCCL_REQUIRES_EXPR((T), T t)((t - t)); using sized_it = random_access_iterator; static_assert(cuda::std::sized_sentinel_for); diff --git a/libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.all/range.ref.view/range.ref.view.pass.cpp b/libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.all/range.ref.view/range.ref.view.pass.cpp index 6178c53bd66..70fd3c16977 100644 --- a/libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.all/range.ref.view/range.ref.view.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.all/range.ref.view/range.ref.view.pass.cpp @@ -182,31 +182,14 @@ struct Cpp20InputRange template <> inline constexpr bool cuda::std::ranges::enable_borrowed_range = true; -#if TEST_STD_VER >= 2020 -template -concept EmptyIsInvocable = requires(cuda::std::ranges::ref_view view) { view.empty(); }; - template -concept SizeIsInvocable = requires(cuda::std::ranges::ref_view view) { view.size(); }; +_CCCL_CONCEPT EmptyIsInvocable = _CCCL_REQUIRES_EXPR((R), cuda::std::ranges::ref_view view)((view.empty())); template -concept DataIsInvocable = requires(cuda::std::ranges::ref_view view) { view.data(); }; -#else // ^^^ C++20 ^^^ / vvv C++17 vvv -template -_CCCL_CONCEPT_FRAGMENT(EmptyIsInvocable_, requires(cuda::std::ranges::ref_view view)((view.empty()))); -template -_CCCL_CONCEPT EmptyIsInvocable = _CCCL_FRAGMENT(EmptyIsInvocable_, R); +_CCCL_CONCEPT SizeIsInvocable = _CCCL_REQUIRES_EXPR((R), cuda::std::ranges::ref_view view)((view.size())); template -_CCCL_CONCEPT_FRAGMENT(SizeIsInvocable_, requires(cuda::std::ranges::ref_view view)((view.size()))); -template -_CCCL_CONCEPT SizeIsInvocable = _CCCL_FRAGMENT(SizeIsInvocable_, R); - -template -_CCCL_CONCEPT_FRAGMENT(DataIsInvocable_, requires(cuda::std::ranges::ref_view view)((view.data()))); -template -_CCCL_CONCEPT DataIsInvocable = _CCCL_FRAGMENT(DataIsInvocable_, R); -#endif // TEST_STD_VER <= 2017 +_CCCL_CONCEPT DataIsInvocable = _CCCL_REQUIRES_EXPR((R), cuda::std::ranges::ref_view view)((view.data())); // Testing ctad. static_assert(cuda::std::same_as())), diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.intializer_list.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.intializer_list.pass.cpp index 9cc71bc80a3..bc522752eb8 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.intializer_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.intializer_list.pass.cpp @@ -31,9 +31,8 @@ #include "test_macros.h" template -_CCCL_CONCEPT_FRAGMENT(CanEmplace_, requires(T t, Args&&... args)((t.emplace(cuda::std::forward(args)...)))); -template -constexpr bool CanEmplace = _CCCL_FRAGMENT(CanEmplace_, T, Args...); +_CCCL_CONCEPT CanEmplace = + _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)((t.emplace(cuda::std::forward(args)...))); static_assert(CanEmplace, int>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.pass.cpp index 4dd07ff4efb..91ece49e7ff 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/assign/emplace.pass.cpp @@ -32,9 +32,8 @@ #include "test_macros.h" template -_CCCL_CONCEPT_FRAGMENT(CanEmplace_, requires(T t, Args&&... args)((t.emplace(cuda::std::forward(args)...)))); -template -constexpr bool CanEmplace = _CCCL_FRAGMENT(CanEmplace_, T, Args...); +_CCCL_CONCEPT CanEmplace = + _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)((t.emplace(cuda::std::forward(args)...))); static_assert(CanEmplace, int>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp index 49b48ab387e..56360da7c2d 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp @@ -41,11 +41,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); static_assert(!ImplicitlyConstructible, cuda::std::in_place_t>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp index d373152ae7a..e917343411e 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.inplace_init_list.pass.cpp @@ -51,11 +51,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); #if defined(_LIBCUDACXX_HAS_VECTOR) diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp index b830efc4196..f004f12ff13 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp @@ -41,11 +41,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); static_assert(!ImplicitlyConstructible, cuda::std::unexpect_t>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp index 1ec015aa6e1..3ae7e6ae9c2 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/ctor/ctor.unexpect_init_list.pass.cpp @@ -52,11 +52,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); #if defined(_LIBCUDACXX_HAS_VECTOR) diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/swap/member.swap.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/swap/member.swap.pass.cpp index 72df905cea0..64a18e4fcff 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/swap/member.swap.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.expected/swap/member.swap.pass.cpp @@ -30,9 +30,8 @@ // Test Constraints: template -_CCCL_CONCEPT_FRAGMENT(HasMemberSwap_, requires(cuda::std::expected x, cuda::std::expected y)((x.swap(y)))); -template -_CCCL_CONCEPT HasMemberSwap = _CCCL_FRAGMENT(HasMemberSwap_, T, E); +_CCCL_CONCEPT HasMemberSwap = + _CCCL_REQUIRES_EXPR((T, E), cuda::std::expected x, cuda::std::expected y)((x.swap(y))); static_assert(HasMemberSwap, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace.pass.cpp index 32466c17809..ae6ecac250f 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace.pass.cpp @@ -36,11 +36,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); static_assert(!ImplicitlyConstructible, cuda::std::in_place_t, int>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace_init_list.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace_init_list.pass.cpp index af2f4b0d6e9..33a9e735e15 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace_init_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.unexpected/ctor/ctor.inplace_init_list.pass.cpp @@ -72,11 +72,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); static_assert( diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp index 77d9ae1abea..6bb0dda883a 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp @@ -41,11 +41,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); static_assert(!ImplicitlyConstructible, cuda::std::unexpect_t>, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp index f8b9d7b5160..ccebf31ad05 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/ctor/ctor.unexpect_init_list.pass.cpp @@ -51,11 +51,8 @@ template __host__ __device__ void conversion_test(T); template -_CCCL_CONCEPT_FRAGMENT(ImplicitlyConstructible_, - requires(Args&&... args)((conversion_test({cuda::std::forward(args)...})))); - -template -constexpr bool ImplicitlyConstructible = _CCCL_FRAGMENT(ImplicitlyConstructible_, T, Args...); +_CCCL_CONCEPT ImplicitlyConstructible = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (conversion_test({cuda::std::forward(args)...}))); static_assert(ImplicitlyConstructible, ""); #if defined(_LIBCUDACXX_HAS_VECTOR) diff --git a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/swap/member.swap.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/swap/member.swap.pass.cpp index 7b78beda196..2ffdb575475 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/swap/member.swap.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/expected/expected.void/swap/member.swap.pass.cpp @@ -29,10 +29,8 @@ // Test Constraints: template -_CCCL_CONCEPT_FRAGMENT(HasMemberSwap_, - requires(cuda::std::expected x, cuda::std::expected y)((x.swap(y)))); -template -_CCCL_CONCEPT HasMemberSwap = _CCCL_FRAGMENT(HasMemberSwap_, E); +_CCCL_CONCEPT HasMemberSwap = + _CCCL_REQUIRES_EXPR((E), cuda::std::expected x, cuda::std::expected y)((x.swap(y))); static_assert(HasMemberSwap, ""); diff --git a/libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp index e126aced9ee..673645b46ac 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp @@ -26,11 +26,8 @@ #include "test_macros.h" template -_CCCL_CONCEPT_FRAGMENT( - HasMakeUniqueForOverwrite_, - requires(Args&&... args)((cuda::std::make_unique_for_overwrite(cuda::std::forward(args)...)))); -template -constexpr bool HasMakeUniqueForOverwrite = _CCCL_FRAGMENT(HasMakeUniqueForOverwrite_, T, Args...); +_CCCL_CONCEPT HasMakeUniqueForOverwrite = _CCCL_REQUIRES_EXPR((T, variadic Args), T t, Args&&... args)( + (cuda::std::make_unique_for_overwrite(cuda::std::forward(args)...))); struct Foo { diff --git a/libcudacxx/test/libcudacxx/std/utilities/optional/optional.monadic/or_else.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/optional/optional.monadic/or_else.pass.cpp index 686e4f09ea0..1a016d36a0d 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/optional/optional.monadic/or_else.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/optional/optional.monadic/or_else.pass.cpp @@ -23,23 +23,9 @@ struct NonMovable NonMovable(NonMovable&&) = delete; }; -#if TEST_STD_VER > 2017 - template -concept has_or_else = requires(Opt&& opt, F&& f) { - { cuda::std::forward(opt).or_else(cuda::std::forward(f)) }; -}; - -#else - -template -_CCCL_CONCEPT_FRAGMENT(HasOrElse, - requires(Opt&& opt, F&& f)(cuda::std::forward(opt).or_else(cuda::std::forward(f)))); - -template -_CCCL_CONCEPT has_or_else = _CCCL_FRAGMENT(HasOrElse, Opt, F); - -#endif +_CCCL_CONCEPT has_or_else = + _CCCL_REQUIRES_EXPR((Opt, F), Opt&& opt, F&& f)((cuda::std::forward(opt).or_else(cuda::std::forward(f)))); template __host__ __device__ cuda::std::optional return_optional();