public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113500] Using std::format with float or double based std::chrono::time_point causes error: no match for 'operator<<' Date: Fri, 19 Jan 2024 11:49:39 +0000 [thread overview] Message-ID: <bug-113500-4-wd7AlYTnQq@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113500-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2024-01-19 11:49 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-19 7:11 [Bug libstdc++/113500] New: " Hirthammer@allterra-dno.de 2024-01-19 7:40 ` [Bug libstdc++/113500] " redi at gcc dot gnu.org 2024-01-19 7:45 ` redi at gcc dot gnu.org 2024-01-19 8:14 ` Hirthammer@allterra-dno.de 2024-01-19 11:49 ` redi at gcc dot gnu.org [this message] 2024-01-19 13:09 ` Hirthammer@allterra-dno.de 2024-01-19 13:39 ` redi at gcc dot gnu.org 2024-01-19 13:44 ` redi at gcc dot gnu.org 2024-01-19 21:26 ` redi at gcc dot gnu.org 2024-01-21 22:25 ` cvs-commit at gcc dot gnu.org 2024-01-21 22:27 ` redi at gcc dot gnu.org 2024-01-22 8:37 ` Hirthammer@allterra-dno.de 2024-01-30 14:55 ` cvs-commit at gcc dot gnu.org 2024-01-30 15:18 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113500-4-wd7AlYTnQq@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).