Skip to content

Commit

Permalink
Fix libfmt errors from not finding enum formatter
Browse files Browse the repository at this point in the history
Recent versions of libfmt have become more strict and require
`enum` types to be formattable:

  static assertion failed due to requirement 'formattable': Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

This is a quick fix to simply use the underlying type.
  • Loading branch information
mhx committed Jun 20, 2023
1 parent 331180d commit d47eb44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions folly/futures/detail/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ namespace {

template <class Enum>
void terminate_unexpected_state(fmt::string_view context, Enum state) {
terminate_with<std::logic_error>(
fmt::format("{} unexpected state: {}", context, state));
terminate_with<std::logic_error>(fmt::format(
"{} unexpected state: {}",
context,
static_cast<std::underlying_type_t<Enum>>(state)));
}

} // namespace
Expand Down

0 comments on commit d47eb44

Please sign in to comment.