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

HLSL enum types do not conform to intended C++ behavior #284

Open
tex3d opened this issue Jun 2, 2022 · 1 comment
Open

HLSL enum types do not conform to intended C++ behavior #284

tex3d opened this issue Jun 2, 2022 · 1 comment
Labels
bug Something isn't working Theme:C++ Issues related to differences or features of C++
Milestone

Comments

@tex3d
Copy link
Collaborator

tex3d commented Jun 2, 2022

The unscoped enum type has differences in behavior in HLSL from the C++ behavior that should be rectified. The primary difference is that it preserves the enum type for binary operator expression results rather than converting to int first and resulting in an int type for the expression.

Additionally, enum struct has unintended differences in behavior from enum class because, other than scoping, it's treated the same way as the unscoped enum type, allowing operations without casting that should require explicit casting.

@tex3d tex3d added the bug Something isn't working label Jun 2, 2022
@devshgraphicsprogramming

Actually it seems to be an accident that your HLSL with an enum class even compiles, you will start getting syntax errors as soon as you try to use the values.

See microsoft/DirectXShaderCompiler#5554

@damyanp damyanp transferred this issue from microsoft/DirectXShaderCompiler Jul 25, 2024
@damyanp damyanp moved this to Triaged in HLSL Triage Aug 8, 2024
@damyanp damyanp added the Theme:C++ Issues related to differences or features of C++ label Aug 8, 2024
@damyanp damyanp added this to the HLSL 202x milestone Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Theme:C++ Issues related to differences or features of C++
Projects
Status: Triaged
Development

No branches or pull requests

3 participants