From 2c0b00a7ed7731559e3e6763b1699734c173ee79 Mon Sep 17 00:00:00 2001 From: neargye Date: Tue, 1 Oct 2019 16:58:35 +0500 Subject: [PATCH] add error if count < 0, fix #15 --- include/magic_enum.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index cffc658..1787f55 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -417,6 +417,7 @@ struct enum_traits>> { static_assert(enum_range::min > (std::numeric_limits::min)(), "magic_enum::enum_range requires min must be greater than INT16_MIN."); static_assert(enum_range::max < (std::numeric_limits::max)(), "magic_enum::enum_range requires max must be less than INT16_MAX."); static_assert(enum_range::max > enum_range::min, "magic_enum::enum_range requires max > min."); + static_assert(count > 0, "magic_enum::enum_range requires enum implementation or valid max and min."); using U = underlying_type; inline static constexpr auto indexes = detail::indexes(detail::range_v); };