KhronosGroup/SYCL-Docs

id<1> operators and integer literals

Opened this issue · 0 comments

The current version of the SYCL 2020 specification allows conversion of size_t to and from id<1> and all operators are defined with a variant taking a size_t RHS operand. However, the way this is defined, the following code would be ambiguous:

sycl::id<1> x{1};
x = x + 1; // Ambiguous: Should it use `int + int` or `id<1> + id<1>`?

Possible solution: Change the operators with size_t arguments to take T instead, where std::is_integral_v<T> is `true. For example, see https://godbolt.org/z/TcM8hrWzE.

Inspired by KhronosGroup/SYCL-CTS#870.