https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113500

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
MSVC rejects this the same way, although libc++ from LLVM 17 compiles it.

AFAICT std::format("{}", tp) would be invalid because that formats tp by
writing to a stream, and there is no operator<< for
sys_time<duration<floating-point>>.

Arguably, std::format("{:%S}", tp) could work, because it doesn't need to use
operator<< but the problem is that we can't detect at compile-time whether or
not we need to use operator<< for a given format string. So it always fails to
compile.

The reason it works with libc++ is because they have a bug in their operator<<
for sys_time.

I think libstdc++ is correct here, but I've asked the C++ committee whether we
might want to change the standard to support this case.

Reply via email to