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

Fix HostReg enum cast outside valid range #2997

Closed

Conversation

j8r
Copy link
Contributor

@j8r j8r commented Aug 20, 2023

LLVM 16 errors by reporting that the valid range of HostReg is between 0 and 15.

I don't have enough knowledge if this is the best fix. Using a different type accepting the 16 value may be another option. I changed to an unsigned type.

Here is the full error:

/duckstation/src/core/cpu_recompiler_types.h:76:37: error: integer value 16 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
constexpr HostReg HostReg_Invalid = static_cast<HostReg>(HostReg_Count);
                                    ^

LLVM 16 errors by reporting that the valid range is between 0 and 15.
@stenzek
Copy link
Owner

stenzek commented Aug 21, 2023

I had already changed this as part of bf15d13 yesterday for clang-cl compatibility, just hadn't pushed it yet.

@stenzek stenzek closed this Aug 21, 2023
@j8r j8r deleted the fix-hostreg-enum-cast-outside-valid-range branch August 21, 2023 19:53
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

Successfully merging this pull request may close these issues.

2 participants