diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 8e2dc42..e7e3f62 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -769,7 +769,7 @@ constexpr auto calculate_cases(std::size_t Page) noexcept { } auto it = result.begin(); - for (auto last_value = (std::numeric_limits::min)(); fill != result.end(); *fill++ = last_value) { + for (auto last_value = (std::numeric_limits::min)(); fill != result.end(); *fill++ = last_value++) { while (last_value == *it) { ++last_value, ++it; } diff --git a/test/test.cpp b/test/test.cpp index 8f5bb8a..cf79c02 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -84,7 +84,7 @@ struct magic_enum::customize::enum_range { enum class MaxUsedAsInvalid : std::uint8_t { ONE, - TWO, + TWO = 63, INVALID = std::numeric_limits::max() }; template <> @@ -582,6 +582,8 @@ TEST_CASE("enum_name") { REQUIRE(nt_name == "three"); REQUIRE(enum_name(number::four).empty()); REQUIRE(enum_name(static_cast(0)).empty()); + + REQUIRE(enum_name(MaxUsedAsInvalid::ONE) == "ONE"); } SECTION("static storage") { @@ -989,7 +991,7 @@ TEST_CASE("extrema") { REQUIRE(magic_enum::detail::max_v == true); REQUIRE(magic_enum::detail::reflected_max_v == 64); - REQUIRE(magic_enum::detail::max_v == 1); + REQUIRE(magic_enum::detail::max_v == 63); } }