diff --git a/libcudacxx/include/cuda/__utility/__basic_any/semiregular.h b/libcudacxx/include/cuda/__utility/__basic_any/semiregular.h index bf2025bdb57..a409badf9a5 100644 --- a/libcudacxx/include/cuda/__utility/__basic_any/semiregular.h +++ b/libcudacxx/include/cuda/__utility/__basic_any/semiregular.h @@ -56,17 +56,17 @@ _CCCL_BEGIN_NAMESPACE_CUDA _CCCL_EXEC_CHECK_DISABLE template -_CCCL_PUBLIC_API auto __move_fn(_Tp& __src, void* __dst) noexcept - -> ::cuda::std::enable_if_t<::cuda::std::movable<_Tp>, void> +_CCCL_PUBLIC_API auto __move_fn(_Tp& __src, void* __dst) noexcept -> void { + static_assert(::cuda::std::movable<_Tp>, "type must be movable"); ::new (__dst) _Tp(static_cast<_Tp&&>(__src)); } _CCCL_EXEC_CHECK_DISABLE template -[[nodiscard]] _CCCL_PUBLIC_API auto __try_move_fn(_Tp& __src, void* __dst, size_t __size, size_t __align) - -> ::cuda::std::enable_if_t<::cuda::std::movable<_Tp>, bool> +[[nodiscard]] _CCCL_PUBLIC_API auto __try_move_fn(_Tp& __src, void* __dst, size_t __size, size_t __align) -> bool { + static_assert(::cuda::std::movable<_Tp>, "type must be movable"); if (::cuda::__is_small<_Tp>(__size, __align)) { ::new (__dst) _Tp(static_cast<_Tp&&>(__src)); @@ -81,9 +81,9 @@ template _CCCL_EXEC_CHECK_DISABLE template -[[nodiscard]] _CCCL_PUBLIC_API auto __copy_fn(_Tp const& __src, void* __dst, size_t __size, size_t __align) - -> ::cuda::std::enable_if_t<::cuda::std::copyable<_Tp>, bool> +[[nodiscard]] _CCCL_PUBLIC_API auto __copy_fn(_Tp const& __src, void* __dst, size_t __size, size_t __align) -> bool { + static_assert(::cuda::std::copyable<_Tp>, "type must be copyable"); if (::cuda::__is_small<_Tp>(__size, __align)) { ::new (__dst) _Tp(__src); diff --git a/libcudacxx/test/libcudacxx/cuda/memory_resource/any_resource/any_resource.cu b/libcudacxx/test/libcudacxx/cuda/memory_resource/any_resource/any_resource.cu index d260d394290..8815e8f81d9 100644 --- a/libcudacxx/test/libcudacxx/cuda/memory_resource/any_resource/any_resource.cu +++ b/libcudacxx/test/libcudacxx/cuda/memory_resource/any_resource/any_resource.cu @@ -329,4 +329,23 @@ TEMPLATE_TEST_CASE_METHOD(test_fixture, "Empty property set", "[container][resou mr.deallocate_sync(this, this->bytes(0), this->align(0)); } } + +struct my_resource_wrapper +{ + explicit my_resource_wrapper(cuda::mr::resource_ref); + + void* allocate(cuda::stream_ref, ::cuda::std::size_t, ::cuda::std::size_t); + void deallocate(cuda::stream_ref, void*, ::cuda::std::size_t, ::cuda::std::size_t) noexcept; + void* allocate_sync(::cuda::std::size_t, ::cuda::std::size_t); + void deallocate_sync(void*, ::cuda::std::size_t, ::cuda::std::size_t) noexcept; + bool operator==(my_resource_wrapper const&) const; + bool operator!=(my_resource_wrapper const&) const; + friend void get_property(my_resource_wrapper const&, cuda::mr::device_accessible) noexcept {} +}; + +// See https://github.com/NVIDIA/cccl/issues/8037 +TEST_CASE("regression test for NVIDIA/cccl#8037", "[container][resource]") +{ + STATIC_REQUIRE(cuda::std::move_constructible); +} #endif // __CUDA_ARCH__