debug: cast unhandled enum to int before printing
This commit is contained in:
parent
04a44c627f
commit
f51beedcdd
@ -527,11 +527,16 @@ namespace cruft::debug::detail {
|
|||||||
void
|
void
|
||||||
unhandled [[noreturn]] (T &&t) noexcept
|
unhandled [[noreturn]] (T &&t) noexcept
|
||||||
{
|
{
|
||||||
|
using base_type = std::remove_reference_t<std::decay_t<T>>;
|
||||||
|
if constexpr (std::is_enum_v<base_type>) {
|
||||||
|
unhandled (static_cast<std::underlying_type_t<base_type>> (t));
|
||||||
|
} else {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "unhandled value: " << t << '\n';
|
os << "unhandled value: " << t << '\n';
|
||||||
::panic (os.str ());
|
::panic (os.str ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user