Skip to content

Commit 4222b4c

Browse files
[SYCL] Restrict sycl::vec and swizzle operations to types mentioned in the SPEC (#13947)
Follow-up of and blocked by: #13945 For `vec<std::byte>`, we only allow math operations that are valid on `std::byte` itself. (https://en.cppreference.com/w/cpp/types/byte)
1 parent 0e587ed commit 4222b4c

File tree

4 files changed

+536
-316
lines changed

4 files changed

+536
-316
lines changed

sycl/include/sycl/detail/generic_type_traits.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ inline constexpr bool is_genfloatptr_marray_v =
252252
(IsDecorated == access::decorated::yes ||
253253
IsDecorated == access::decorated::no);
254254

255+
template <typename T>
256+
using is_byte = typename
257+
#if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0)
258+
std::is_same<T, std::byte>;
259+
#else
260+
std::false_type;
261+
#endif
262+
263+
template <typename T> inline constexpr bool is_byte_v = is_byte<T>::value;
264+
255265
template <typename T>
256266
using make_floating_point_t = make_type_t<T, gtl::scalar_floating_list>;
257267

0 commit comments

Comments
 (0)