Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions sycl/include/sycl/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,19 +513,9 @@ struct map_type<T, From, To, Rest...> {
using type = std::conditional_t<std::is_same_v<From, T>, To,
typename map_type<T, Rest...>::type>;
};
template <typename T, typename... Ts> constexpr bool CheckTypeIn() {
constexpr bool SameType[] = {
std::is_same_v<std::remove_cv_t<T>, std::remove_cv_t<Ts>>...};
// 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 <typename... Ts> constexpr bool check_type_in_v = CheckTypeIn<Ts...>();
template <typename T, typename... Ts>
constexpr bool check_type_in_v = ((std::is_same_v<T, Ts> || ...));

} // namespace detail
} // namespace _V1
Expand Down
6 changes: 6 additions & 0 deletions sycl/include/sycl/marray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ template <typename T, typename... Ts> struct GetMArrayArgsSize<T, Ts...> {
/// \ingroup sycl_api
template <typename Type, std::size_t NumElements> class marray {
using DataT = Type;
static_assert(std::is_same_v<DataT, std::remove_cv_t<DataT>> &&
std::is_default_constructible_v<DataT> &&
std::is_copy_constructible_v<DataT> &&
std::is_copy_assignable_v<DataT> &&
std::is_destructible_v<DataT>,
"DataT must be a NumericType");

public:
using value_type = Type;
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/sycl/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class __SYCL_EBO vec
: public detail::vec_arith<DataT, NumElements>,
public detail::ScalarConversionOperatorMixIn<vec<DataT, NumElements>,
DataT, NumElements> {
static_assert(std::is_same_v<DataT, std::remove_cv_t<DataT>>,
"DataT must be cv-unqualified");

static_assert(NumElements == 1 || NumElements == 2 || NumElements == 3 ||
NumElements == 4 || NumElements == 8 || NumElements == 16,
Expand Down
6 changes: 0 additions & 6 deletions sycl/test/basic_tests/marray/marray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ template <size_t N> bool AllTrue(sycl::marray<bool, N> 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 <typename T> void CheckBinOps() {
sycl::marray<T, 3> ref_arr0{T(0)};
sycl::marray<T, 3> ref_arr1{T(1)};
Expand Down Expand Up @@ -223,7 +218,6 @@ int main() {
CheckConstexprVariadicCtors<sycl::half>();
CheckConstexprVariadicCtors<float>();
CheckConstexprVariadicCtors<double>();
CheckConstexprVariadicCtors<NotDefaultConstructible>();

// check trivially copyability
struct Copyable {
Expand Down
Loading