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] Using std::format with float or double based std::chrono::time_point causes error: no match for 'operator<<'
Date: Mon, 22 Jan 2024 08:37:47 +0000 [thread overview]
Message-ID: <bug-113500-4-XnvvlKm1UW@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 #11 from Hirthammer@allterra-dno.de ---
(In reply to Jonathan Wakely from comment #7)
> (In reply to Jonathan Wakely from comment #6)
> > (In reply to Hirthammer from comment #5)
> > > This whole thing with std::format and std::chrono::time_point is currently a
> > > total minefield.
> >
> > That seems like an exaggeration.
> >
> > > In MSVC it is even more complicated and I already reported
> > > the bug in October 2023. See:
> > >
> > > https://developercommunity.visualstudio.com/t/Using-std::format-with-
> > > unsigned-integer-/10501153
> > >
> > > If you change the clock to utc_clock or gps_clock the code compiles with
> > > MSVC (but not with GCC) on Compiler Explorer.
> >
> > It compiles fine with GCC for me.
>
> Ah, maybe you mean your original example. The one at in the MSVC bug report
> compiles fine with GCC using utc_clock and gps_clock.
>
> Your original example doesn't, because formatting a utc_time or gps_time is
> specified in terms of a sys_time, and that's how libstdc++ implements it. So
> if the utc_time or gps_time uses a float rep, we're back to square one.
>
> I'll ask the committee to clarify that too.
Yes, I was referring to my original example because it helped me to understand
which combinations worked and which did not.
I wrote a wrapper class around std::chrono::time_point, because I am dealing a
lot with different time formats. I am also doing multi-platform development,
and during the testing phase, it turned out that no compiler was able to
compile all templated test cases (Clang uses libstdc++ if you do not explicitly
tell it not to do, as you pointed out on the llvm bug report). Since the error
case parameter combinations differed from MSVC and GCC, I had to use many
different compiler-specific sections to get consistent and valid behavior in
the tests. That's why I called it a minefield. Maybe it was exaggerated ;).
Anyways, thank you a lot for your effort and clarifications and especially for
the fast fix.
next prev parent reply other threads:[~2024-01-22 8:37 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
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 [this message]
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-XnvvlKm1UW@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: link
Be 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).