From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 670C13858C39; Mon, 22 Jan 2024 08:37:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 670C13858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705912673; bh=D/izAKJeBUJ7ZEZZDN0NXG3WjueYPMragMfdGhNshKA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kAGE0P4ZWcoaSZJhFKal22H2ci2fJvwDQhBxNP/ijM2awRglaD15HQHlJdcvllzoR ECRBFmt2MASwCGZJjEObaE20ntaZUtYwyKp1Abzb8rvfUO+ZqQDxqGw3nFXJyyGEAR /UNoVIkImL31kDP/T++i7b5amptPQtE6vg6gN65I= From: "Hirthammer@allterra-dno.de" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Hirthammer@allterra-dno.de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113500 --- 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 curr= ently a > > > total minefield. > >=20 > > That seems like an exaggeration. > >=20 > > > In MSVC it is even more complicated and I already reported > > > the bug in October 2023. See: > > >=20 > > > https://developercommunity.visualstudio.com/t/Using-std::format-with- > > > unsigned-integer-/10501153 > > >=20 > > > If you change the clock to utc_clock or gps_clock the code compiles w= ith > > > MSVC (but not with GCC) on Compiler Explorer. > >=20 > > It compiles fine with GCC for me. >=20 > Ah, maybe you mean your original example. The one at in the MSVC bug repo= rt > compiles fine with GCC using utc_clock and gps_clock. >=20 > 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. >=20 > I'll ask the committee to clarify that too. Yes, I was referring to my original example because it helped me to underst= and which combinations worked and which did not.=20 I wrote a wrapper class around std::chrono::time_point, because I am dealin= g 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 explic= itly tell it not to do, as you pointed out on the llvm bug report). Since the er= ror 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.=