-
Notifications
You must be signed in to change notification settings - Fork 452
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
Regression in PR #323 #330
Comments
This assert was added to give an error if there are no enum values reflected. enum class MasterserverMessageType
{
M2H_ACCEPT = 1000,
M2H_HOST_GAME_INIT = 1002,
L2H_HOST_PLAYER_INIT = 1003,
M2H_GAME_LEAVE = 1007,
};
auto test = magic_enum::enum_name((MasterserverMessageType)1003); // empty string
std::cout << test << std::endl; // output = '' You can add the old behavior defined macro |
So coming back to it, turns out I basically had to specify something like this template <>
struct magic_enum::customize::enum_range<MasterserverMessageType> {
static constexpr int min = (const int)MasterserverMessageType::M2H_ACCEPT;
static constexpr int max = (const int)MasterserverMessageType::S2L_SECURITY;
// (max - min) must be less than UINT16_MAX.
}; which was mentioned in the I guess this also would mean that before this commit that has the check, the logs I had probably didn't work ever to begin with and I just never noticed until the error came? Anyway I help my comment helps someone in the future or something. @Neargye my small suggestion would be to try leading the user from the error message somehow towards how they can fix it or what they could otherwise do to alleviate the issue. If not in the error itself, then perhaps where it's defined some link to https://github.com/Neargye/magic_enum/blob/master/doc/limitations.md#enum-range or something like that? Could help someone in the future too... |
yes, might be worth adding a link to limitations |
After #323 it seems
enum class
doesn't work anymore. I have en example enumand example invokation
fails with:
It seems to point at this static_assert failing:
Worth pointing out that before updating magic_enum, the code worked perfectly fine, so this really points at the checks being wrong. Compiler is MSVC from Visual Studio 2022 (latest v17.7.7)
The text was updated successfully, but these errors were encountered: