Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id<1> operators and integer literals #539

Open
steffenlarsen opened this issue Mar 7, 2024 · 0 comments
Open

id<1> operators and integer literals #539

steffenlarsen opened this issue Mar 7, 2024 · 0 comments

Comments

@steffenlarsen
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant