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