diff --git a/include/nameof.hpp b/include/nameof.hpp index 70646c7..38fc292 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -156,21 +156,21 @@ struct nameof_enum_t final { [[nodiscard]] constexpr std::string_view operator()(int value) const noexcept { switch (value - V) { case 0: - return nameof_enum_impl(); + return nameof_enum_impl(V)>(); case 1: - return nameof_enum_impl(); + return nameof_enum_impl(V + 1)>(); case 2: - return nameof_enum_impl(); + return nameof_enum_impl(V + 2)>(); case 3: - return nameof_enum_impl(); + return nameof_enum_impl(V + 3)>(); case 4: - return nameof_enum_impl(); + return nameof_enum_impl(V + 4)>(); case 5: - return nameof_enum_impl(); + return nameof_enum_impl(V + 5)>(); case 6: - return nameof_enum_impl(); + return nameof_enum_impl(V + 6)>(); case 7: - return nameof_enum_impl(); + return nameof_enum_impl(V + 7)>(); default: return nameof_enum_t{}(value); } @@ -241,7 +241,7 @@ template >> template >>> [[nodiscard]] constexpr std::string_view nameof_enum(T value) noexcept { - constexpr auto s = std::is_signed_v>>; + constexpr bool s = std::is_signed_v>>; return detail::nameof_enum_t, s ? -NAMEOF_ENUM_MAX_SEARCH_DEPTH : 0>{}(static_cast(value)); } diff --git a/test/test.cpp b/test/test.cpp index 695223c..0383f0e 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -69,7 +69,7 @@ struct Long { enum class Color { RED = -1, GREEN, BLUE }; -enum Directions : int { Up, Down, Right, Left}; +enum Directions { Up, Down, Right, Left}; SomeStruct struct_var; Long othervar;