diff --git a/debug.hpp b/debug.hpp index c2ed0105..c1dd7df4 100644 --- a/debug.hpp +++ b/debug.hpp @@ -527,9 +527,14 @@ namespace cruft::debug::detail { void unhandled [[noreturn]] (T &&t) noexcept { - std::ostringstream os; - os << "unhandled value: " << t << '\n'; - ::panic (os.str ()); + using base_type = std::remove_reference_t>; + if constexpr (std::is_enum_v) { + unhandled (static_cast> (t)); + } else { + std::ostringstream os; + os << "unhandled value: " << t << '\n'; + ::panic (os.str ()); + } } }