diff --git a/include/alpaka/kernel/Traits.hpp b/include/alpaka/kernel/Traits.hpp index 44b6476aa4f7..b4890148c235 100644 --- a/include/alpaka/kernel/Traits.hpp +++ b/include/alpaka/kernel/Traits.hpp @@ -248,6 +248,19 @@ namespace alpaka } } // namespace detail + template + struct IsKernelTriviallyCopyable +#if BOOST_COMP_NVCC + : std::bool_constant || __nv_is_extended_device_lambda_closure_type(T) || __nv_is_extended_host_device_lambda_closure_type(T)> +#else + : std::bool_constant> +#endif + { + }; + + template + inline constexpr bool isKernelTriviallyCopyable = IsKernelTriviallyCopyable::value; + //! Creates a kernel execution task. //! //! \tparam TAcc The accelerator type. @@ -266,11 +279,10 @@ namespace alpaka #if BOOST_COMP_NVCC static_assert( - std::is_trivially_copyable_v || __nv_is_extended_device_lambda_closure_type(TKernelFnObj) - || __nv_is_extended_host_device_lambda_closure_type(TKernelFnObj), + isKernelTriviallyCopyable, "Kernels must be trivially copyable or an extended CUDA lambda expression!"); #else - static_assert(std::is_trivially_copyable_v, "Kernels must be trivially copyable!"); + static_assert(isKernelTriviallyCopyable, "Kernels must be trivially copyable!"); #endif (detail::assertKernelArgIsTriviallyCopyable>(), ...); static_assert(