blueprint-freespeech / ricochet-refresh

Anonymous peer-to-peer instant messaging
https://www.ricochetrefresh.net
Other
157 stars 27 forks source link

FileChannel.cpp:323:35: error: direction: Cannot format an argument #180

Open milahu opened 5 months ago

milahu commented 5 months ago

ricochet version cfa98b851fa7e5eaf7294c37aa3fd7bebcccfba8 build fails with fmt versions

FileChannel.cpp:323:35

https://github.com/blueprint-freespeech/ricochet-refresh/blob/cfa98b851fa7e5eaf7294c37aa3fd7bebcccfba8/src/libtego/source/protocol/FileChannel.cpp#L323

fmt::format("Unknown FileChannel::direction()", direction)

direction is not formattable

quickfix

-  fmt::format("Unknown FileChannel::direction()", direction)
+  "Unknown FileChannel::direction()"

fmt-10.1.1-dev/include/fmt/core.h:1576:63: error: 'fmt::v10::detail::type_is_unformattable_for<const Protocol::Channel::Direction, char> _' has incomplete type fmt-10.1.1-dev/include/fmt/core.h:1580:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt

fmt docs: https://fmt.dev/latest/api.html#udt

[ 27%] Building CXX object libtego/CMakeFiles/tego.dir/source/protocol/FileChannel.cpp.o
In file included from /nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/format.h:49,
                 from /build/source/src/libtego/source/precomp.h:66,
                 from /build/source/src/build/libtego/CMakeFiles/tego.dir/cmake_pch.hxx:5,
                 from <command-line>:
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h: In instantiation of 'constexpr decltype (ctx.begin()) fmt::v10::detail::parse_format_specs(ParseContext&) [with T = Protocol::Channel::Direction; ParseContext = compile_parse_context<char>; decltype (ctx.begin()) = const char*]':
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:2611:22:   required from 'constexpr fmt::v10::detail::format_string_checker<Char, Args>::format_string_checker(fmt::v10::basic_string_view<Char>) [with Char = char; Args = {Protocol::Channel::Direction}]'
/build/source/src/libtego/source/protocol/FileChannel.cpp:323:35:   required from here
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:2548:45: error: 'fmt::v10::detail::type_is_unformattable_for<Protocol::Channel::Direction, char> _' has incomplete type
 2548 |     type_is_unformattable_for<T, char_type> _;
      |                                             ^
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h: In instantiation of 'constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&) [with bool PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = const Protocol::Channel::Direction; typename std::enable_if<PACKED, int>::type <anonymous> = 0]':
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:1808:51:   required from 'constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T& ...) [with T = {const Protocol::Channel::Direction}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {Protocol::Channel::Direction}]'
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:1826:18:   required from 'constexpr fmt::v10::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<_Args>::type>::type ...> fmt::v10::make_format_args(T& ...) [with Context = basic_format_context<appender, char>; T = {const Protocol::Channel::Direction}]'
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:2788:44:   required from 'std::string fmt::v10::format(format_string<T ...>, T&& ...) [with T = {const Protocol::Channel::Direction&}; std::string = std::__cxx11::basic_string<char>; format_string<T ...> = basic_format_string<char, const Protocol::Channel::Direction&>]'
/build/source/src/libtego/source/protocol/FileChannel.cpp:323:35:   required from here
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:1576:63: error: 'fmt::v10::detail::type_is_unformattable_for<const Protocol::Channel::Direction, char> _' has incomplete type
 1576 |     type_is_unformattable_for<T, typename Context::char_type> _;
      |                                                               ^
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:1580:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
 1580 |       formattable,
      |       ^~~~~~~~~~~
/nix/store/sgslg7d6dyr7962pc5dq6wl5g9p48bv2-fmt-10.1.1-dev/include/fmt/core.h:1580:7: note: 'formattable' evaluates to false
pospeselr commented 5 months ago

Yes I think I ran into this problem in another project as well, it seems it's no longer sufficient to implement an ostream operator<<(ostream&, T) function with newer fmt versions >:[