[Bug 286855] net-p2p/transmission-components: Fails to compile with fmt 11.2.0
Date: Sat, 09 Aug 2025 10:34:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286855
Matthias Andree <mandree@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mandree@FreeBSD.org
Status|New |In Progress
Assignee|ports-bugs@FreeBSD.org |mandree@FreeBSD.org
Flags|maintainer-feedback?(mondo. |maintainer-feedback-
|debater_0q@icloud.com) |
--- Comment #6 from Matthias Andree <mandree@FreeBSD.org> ---
Maintainer timeout.
(In reply to Daniel Engberg from comment #0)
The crucial part of the error message is for line 1918, and it's - for a C++
developer anyways - clear that this is the actual error site. Someone tries to
format msgs->io through fmt::ptr, but the system says it can't cast that to a
naked pointer implicitly.
Next step, fmt's compile-time type checking thankfully breaks the compile at
the very place where the bug is, and that's why fmt is great: on a new enough
compiler (either C++20, or C++14 with FMT_STRING macro as is used here), it
breaks noisily instead of formatting garbage.
The bottom part of the notes tells us what type conversions the compiler
considered but rejected, and why. The std::shared_ptr<tr_peerIo> isn't itself
a pointer, and it also doesn't fit into a void *'s storage. So that would have
caused truncation of the formatted output, and fmt rejected that.
The solution is to obtain that convertible pointer, and for a std::shared_ptr
that's done with the .get() method call, or equivalently, prefixing that shared
pointer with &* (dereference and then get the address).
In file included from
/usr/ports/net-p2p/transmission-components/work-cli/transmission-4.0.6/libtransmission/peer-msgs.cc:19:
/usr/local/include/fmt/format.h:3828:17: error: static assertion failed due to
requirement 'std::is_pointer<std::shared_ptr<tr_peerIo>>::value':
3828 | static_assert(std::is_pointer<T>::value, "");
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/net-p2p/transmission-components/work-cli/transmission-4.0.6/libtransmission/peer-msgs.cc:1918:105:
note: in instantiation of function template specialization
'fmt::ptr<std::shared_ptr<tr_peerIo>>' requested here
1918 | logtrace(msgs, fmt::format(FMT_STRING("flushing outMessages...
to {:p} (length is {:d})"), fmt::ptr(msgs->io), len));
|
^
In file included from
/usr/ports/net-p2p/transmission-components/work-cli/transmission-4.0.6/libtransmission/peer-msgs.cc:19:
/usr/local/include/fmt/format.h:3829:10: error: no matching function for call
to 'bit_cast'
3829 | return detail::bit_cast<const void*>(p);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/fmt/format.h:249:22: note: candidate template ignored:
requirement 'sizeof(const void *) == sizeof(std::shared_ptr<tr_peerIo>)' was
not satisfied [with To = const void *, From = std::shared_ptr<tr_peerIo>]
249 | FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
| ^
/usr/local/include/fmt/format.h:410:13: note: candidate template ignored:
requirement 'sizeof(const void *) > sizeof(std::shared_ptr<tr_peerIo>)' was not
satisfied [with To = const void *, From = std::shared_ptr<tr_peerIo>]
410 | inline auto bit_cast(const From& from) -> To {
| ^
2 errors generated.
ninja: build stopped: subcommand failed.
--
You are receiving this mail because:
You are the assignee for the bug.