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

Reserved ^^ operator parsing ambiguity #1264

Open
AaronBallman opened this issue Sep 16, 2024 · 0 comments
Open

Reserved ^^ operator parsing ambiguity #1264

AaronBallman opened this issue Sep 16, 2024 · 0 comments

Comments

@AaronBallman
Copy link

OpenCL 3.0 (and earlier) reserves the ^^ token. However, OpenCL also works with (and encourages use of) the blocks extension, which uses ^ as part of its block expression syntax. This leads to an ambiguity with an immediately called block, as in:

unsigned x=0;
unsigned y=x^^{return 0;}();

This should result in y holding the value zero (0^0) through an immediately invoked block call as the right-hand side of the xor operator. However, it causes errors instead because of this reserved token: https://godbolt.org/z/navf7jTv1

Immediately called blocks (and lambdas) are not uncommon, so perhaps this is a reason to no longer reserve ^^ as a token. Another thing to consider is that WG21 is considering using ^^ as a token for reflection: https://isocpp.org/files/papers/P3381R0.html

Perhaps this token should no longer be reserved in OpenCL?

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

No branches or pull requests

1 participant