Skip to content
Merged
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
3 changes: 2 additions & 1 deletion sycl/include/sycl/detail/vector_arith.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ template <typename Self> struct VecOperators {
// ensure we generate 0/1 only (and not 2/-1/etc.).
#if __clang_major__ >= 20
// Not an integral constant expression prior to clang-20.
static_assert((ext_vector<int8_t, 2>{1, 0} == 0)[1] == -1);
static_assert(
static_cast<int8_t>((ext_vector<int8_t, 2>{1, 0} == 0)[1]) == -1);
Comment on lines +268 to +269
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better fix would be to use the same expression here and in line 272 (whatever it would be). @hvdijk any thoughts on that?

Copy link
Contributor Author

@hvdijk hvdijk Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but the below needs to construct a vector which cannot be done with static_cast (and also, ext_vector is not available on GCC, but that might not matter here), and the below reinterpret_cast makes the expression non-constant so it cannot be used in static_assert.

#endif

tmp = reinterpret_cast<decltype(tmp)>((tmp != 0) * -1);
Expand Down