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

Incorrect Message with uint32_t enum values #40

Closed
avlec opened this issue Jul 20, 2022 · 2 comments
Closed

Incorrect Message with uint32_t enum values #40

avlec opened this issue Jul 20, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@avlec
Copy link

avlec commented Jul 20, 2022

With the NAMEOF_ENUM_RANGE_MIN and NAMEOF_ENUM_RANGE_MAX set to [0, N] an enum like the following seems to produce an incorrect warning message.

#include <cstdint>
enum Test : uint32_t
{
    First = 0,
    Last = 0xFFFFFFFF,
};
[build] ../../tests/nameof.hpp:526:21: error: static assertion failed: nameof::enum_range detects enum value smaller than min range size.
[build]   526 |       static_assert(!is_valid<E, value<E, lhs - 1, IsFlags>(0)>(), "nameof::enum_range detects enum value smaller than min range size.");

I would expect the warning to be something line "enum larger than the max range size"

@avlec
Copy link
Author

avlec commented Jul 21, 2022

Reproduced it with a smaller enum of size uint8_t with NAMEOF_ENUM_RANGE_MIN 0 and NAMEOF_ENUM_RANGE_MAX 4096. It seems to not like when the first bit is a 1. Some problem with the signedness. This should be a valid use case

enum Test : uint8_t
{
    First = 0,
    //...
    Last = 0xFF,
}

@Neargye Neargye added the bug Something isn't working label Jul 21, 2022
@Neargye
Copy link
Owner

Neargye commented Jul 21, 2022

fixed in master, will be in next release

@Neargye Neargye closed this as completed Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants