Приведен код, который был успешно скомпилирован с помощью fmt v9.1, но не скомпилирован с fmt v10+
Это определенное поведение, но оно меня немного сбило с толку, прежде чем я начал проверять проблемы на GitHub. Кроме того, проблемы с github не указывают версию в заголовке.
#include #include #include используя Test = enum Test_e{ А, Б, С }; int main(int, char **) { fmt::print(std::cout, "test enum {}\n", A); } При обновлении libfmt до версии 10.0 появляются следующие сообщения об ошибках: Живая демонстрация
В файле, включенном из :2: /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h: при создании экземпляра 'fmt::v10::detail::value fmt::v10::detail::make_value (T&&) [with Context = fmt::v10::basic_format_context; Т = Тест_е&]': /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h

29: требуется от 'fmt::v10::detail::value fmt::v10::detail ::make_arg(T&&) [с bool IS_PACKED = true; Контекст = fmt::v10::basic_format_context; тип = fmt::v10::detail::type::custom_type; Т = Тест_е&; typename std::enable_if::type = 0]' /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h

77: требуется из 'fmt::v10::format_arg_store::format_arg_store(T&& ... ) [с T = {Test_e&}; Контекст = fmt::v10::basic_format_context; Args = {Test_e}]' /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h

31: требуется из 'constexpr fmt::v10::format_arg_store fmt::v10::make_format_args(T&& ...) [with Context = Basic_format_context; Т = {Test_e&}]' /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/ostream.h:179:44: требуется из 'void fmt::v10::print(std::ostream&, format_string, T&& ...) [with T = {Test_e}; std::ostream = std::basic_ostream; format_string = Basic_format_string]' :10:15: требуется отсюда /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h

7: ошибка: ошибка статического утверждения: невозможно отформатировать аргумент. Чтобы сделать форматируемым тип T, укажите специализацию форматтера:
https://fmt.dev/latest/api.html#udt 1691 | форматируемый, | ^~~~~~~~~~~ /opt/compiler-explorer/libs/fmt/10.0.0/include/fmt/core.h

7: примечание: значение 'formattable' равно false Компилятор вернул: 1 Похожие вопросы в github
[*]
https://github.com/fmtlib/fmt/issues/3720 [*]
https://github.com/fmtlib/fmt/issues/3671