diff --git a/sycl/include/sycl/detail/type_traits.hpp b/sycl/include/sycl/detail/type_traits.hpp index 51c638baaa075..f5640f8429564 100644 --- a/sycl/include/sycl/detail/type_traits.hpp +++ b/sycl/include/sycl/detail/type_traits.hpp @@ -513,19 +513,9 @@ struct map_type { using type = std::conditional_t, To, typename map_type::type>; }; -template constexpr bool CheckTypeIn() { - constexpr bool SameType[] = { - std::is_same_v, std::remove_cv_t>...}; - // Replace with std::any_of with C++20. - for (size_t I = 0; I < sizeof...(Ts); ++I) - if (SameType[I]) - return true; - return false; -} -// NOTE: We need a constexpr variable definition for the constexpr functions -// as MSVC thinks function definitions are the same otherwise. -template constexpr bool check_type_in_v = CheckTypeIn(); +template +constexpr bool check_type_in_v = ((std::is_same_v || ...)); } // namespace detail } // namespace _V1 diff --git a/sycl/include/sycl/marray.hpp b/sycl/include/sycl/marray.hpp index bc45a45424312..7419fbdcb73e6 100644 --- a/sycl/include/sycl/marray.hpp +++ b/sycl/include/sycl/marray.hpp @@ -48,6 +48,12 @@ template struct GetMArrayArgsSize { /// \ingroup sycl_api template class marray { using DataT = Type; + static_assert(std::is_same_v> && + std::is_default_constructible_v && + std::is_copy_constructible_v && + std::is_copy_assignable_v && + std::is_destructible_v, + "DataT must be a NumericType"); public: using value_type = Type; diff --git a/sycl/include/sycl/vector.hpp b/sycl/include/sycl/vector.hpp index 6a0e10fe01a6d..371108a6eae4f 100644 --- a/sycl/include/sycl/vector.hpp +++ b/sycl/include/sycl/vector.hpp @@ -131,6 +131,8 @@ class __SYCL_EBO vec : public detail::vec_arith, public detail::ScalarConversionOperatorMixIn, DataT, NumElements> { + static_assert(std::is_same_v>, + "DataT must be cv-unqualified"); static_assert(NumElements == 1 || NumElements == 2 || NumElements == 3 || NumElements == 4 || NumElements == 8 || NumElements == 16, diff --git a/sycl/test/basic_tests/marray/marray.cpp b/sycl/test/basic_tests/marray/marray.cpp index baf9aeb5a363d..b48fe70f17520 100644 --- a/sycl/test/basic_tests/marray/marray.cpp +++ b/sycl/test/basic_tests/marray/marray.cpp @@ -38,11 +38,6 @@ template bool AllTrue(sycl::marray M) { AllTrue((LHS OP RHS[0]) == (LHS OP RHS)) && \ AllTrue((LHS[0] OP RHS[0]) == (LHS OP RHS))); -struct NotDefaultConstructible { - NotDefaultConstructible() = delete; - constexpr NotDefaultConstructible(int){}; -}; - template void CheckBinOps() { sycl::marray ref_arr0{T(0)}; sycl::marray ref_arr1{T(1)}; @@ -223,7 +218,6 @@ int main() { CheckConstexprVariadicCtors(); CheckConstexprVariadicCtors(); CheckConstexprVariadicCtors(); - CheckConstexprVariadicCtors(); // check trivially copyability struct Copyable {