diff --git a/include/nameof.hpp b/include/nameof.hpp index 407470a..f6bfe56 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -162,6 +162,7 @@ template template [[nodiscard]] constexpr std::string_view nameof_enum_impl() noexcept { + static_assert(std::is_enum_v); #if defined(__clang__) std::string_view name{__PRETTY_FUNCTION__}; constexpr auto suffix = sizeof("]") - 1; @@ -190,6 +191,7 @@ template template struct nameof_enum_impl_t final { [[nodiscard]] constexpr std::string_view operator()(int value) const noexcept { + static_assert(std::is_enum_v); if constexpr (V > std::numeric_limits>::max()) { return "nameof_enum::out_of_range"; } @@ -220,6 +222,7 @@ struct nameof_enum_impl_t final { template struct nameof_enum_impl_t final { [[nodiscard]] constexpr std::string_view operator()(int) const noexcept { + static_assert(std::is_enum_v); return "nameof_enum::out_of_range"; } };