public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "Hirthammer@allterra-dno.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113500] New: Using std::format with float or double based std::chrono::time_point causes error: no match for 'operator<<' Date: Fri, 19 Jan 2024 07:11:04 +0000 [thread overview] Message-ID: <bug-113500-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113500 Bug ID: 113500 Summary: Using std::format with float or double based std::chrono::time_point causes error: no match for 'operator<<' Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: Hirthammer@allterra-dno.de Target Milestone: --- Consider the following code snippet: --- using Representation = double; using Duration = std::chrono::duration<Representation>; using Clock = std::chrono::system_clock; using TimePoint = std::chrono::time_point<Clock, Duration>; TimePoint tp = {}; std::string time_string = std::format("{:%d.%m.%Y %H:%M:%S}", tp); --- This results in the compile error: --- error: no match for 'operator<<' (operand types are 'std::__cxx11::basic_ostringstream<char>' and 'const std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<float> >') 726 | __os << __t; | ~~~~~^~~~~~ --- If you change the type def `Representation` to an integer or unsigned integer type, the code compiles. System Info: ~~~ OS: Ubuntu 22.04 LTS GCC-Version: 13.1.0 arguments: -std=c++20 ~~~ Here is a link with the code that produces the error in Compiler Explorer: https://godbolt.org/z/hhPrG1z37 Side note: Don't know if it helps, but the latest clang compiler version produces the same error. The related bug report can be found here: https://github.com/llvm/llvm-project/issues/78555
next reply other threads:[~2024-01-19 7:11 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-19 7:11 Hirthammer@allterra-dno.de [this message] 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 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@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).