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

I can't compile (C2131) when NAMEOF_ENUM_RANGE_MAX >= 3590 #64

Closed
dpieve opened this issue Oct 3, 2023 · 3 comments · Fixed by #65
Closed

I can't compile (C2131) when NAMEOF_ENUM_RANGE_MAX >= 3590 #64

dpieve opened this issue Oct 3, 2023 · 3 comments · Fixed by #65

Comments

@dpieve
Copy link

dpieve commented Oct 3, 2023

If I set NAMEOF_ENUM_RANGE_MAX to 3590 (or more) then I receive the error C2131:

nameof-v0.10.3\include\nameof.hpp(714,52): error C2131: expression did not evaluate to a constant

If NAMEOF_ENUM_RANGE_MAX <= 3580, it works fine.

The limitations say I could go up to INT16_MAX (32766). What am I missing?

Code:

#define NAMEOF_ENUM_RANGE_MIN 0
#define NAMEOF_ENUM_RANGE_MAX 3590 // <= 3580 or less would work. 
#include <nameof.hpp>

enum class TestType: uint32_t { None = 0 };
auto none = nameof::nameof_enum(TestType::None);

Setup

Visual Studio 17.7.2;
/std:c++latest
nameof v0.10.3

@dpieve dpieve changed the title I can't compile (C2131) when I change NAMEOF_ENUM_RANGE_MAX >= 3590 I can't compile (C2131) when NAMEOF_ENUM_RANGE_MAX >= 3590 Oct 3, 2023
@dpieve
Copy link
Author

dpieve commented Oct 3, 2023

Same occurs if I inject in namespace nameof::customize. Copying the example from here.

enum class number { one = 100, two = 200, three = 4000 }; // three is greater than 3590.
template <> struct nameof::customize::enum_range<number> { static constexpr int min = 100; static constexpr int max = 4000; }
auto none = nameof::nameof_enum(number::three); // fails.

@dpieve
Copy link
Author

dpieve commented Oct 11, 2023

I tried to use the/constexprcompiler options. It didn't work either. Same error occurs.

@Neargye
Copy link
Owner

Neargye commented Nov 12, 2023

Could you please test big_range branch?

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 a pull request may close this issue.

2 participants