-
Notifications
You must be signed in to change notification settings - Fork 689
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
[HLSL 2021] Overloaded array operator error about constness #4340
Comments
It would appear we support a normal named method this way without Incidentally, if you try to write to Idx in the method, you'll get another bug:
|
Partially fixes microsoft#4340
#5018 should address the initial usability issue of the subscript operator on We also have a proposal to add https://github.com/microsoft/hlsl-specs/blob/main/proposals/0007-const-instance-methods.md And a PR on that proposal I wrote yesterday extends it to more broadly adopt const-correctness for HLSL data types: |
This change should have no functional impact on compilation. The goal is to remove cases where we rely on the subscript operator's name for special resolution rules and instead key the behavior off an attribute on the method declaration. The added test cases are not exhaustive but try to cover at least one object type exercising each code path modified in this change. Also added a test case for HLSL 2021 user defined array operator. This change partially addresses #4340. The remaining parts of that issue will be addressed in a future HLSL language revision.
The following snippet illustrates an error I get when trying to overload the array operator. The error output is:
Regards,
Tom
The text was updated successfully, but these errors were encountered: