From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4EA283858C56; Fri, 19 Jan 2024 07:11:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4EA283858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705648265; bh=YKdgqy/Z6XbmwjR0PjRm9D/A57sEDBQXrwkJiUDqUzA=; h=From:To:Subject:Date:From; b=YG3HCQRw38LDMSIOr3dNg4dVtR98g9R4WLECp1vlEXZHmSfcWlDBzIEXgg9GFWsfL nzGjs7OSQl+VF/rMf7LEyGNAgrWwK0UOieOFlLVSGYaJxXn9krfYQxr4Tmvl18Rtdy pfffnabN6Chy6DpbB1B9uizK3v80U8cMCT96wXIY= From: "Hirthammer@allterra-dno.de" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 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 =3D double; using Duration =3D std::chrono::duration; using Clock =3D std::chrono::system_clock; using TimePoint =3D std::chrono::time_point; TimePoint tp =3D {}; std::string time_string =3D 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' and 'const std::chrono::time_point >') 726 | __os << __t; | ~~~~~^~~~~~ --- If you change the type def `Representation` to an integer or unsigned integ= er type, the code compiles. System Info: ~~~ OS: Ubuntu 22.04 LTS GCC-Version: 13.1.0 arguments: -std=3Dc++20 ~~~ Here is a link with the code that produces the error in Compiler Explorer: https://godbolt.org/z/hhPrG1z37 Side note:=20 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=