From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FD0C3858403; Fri, 19 Jan 2024 11:49:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FD0C3858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705664981; bh=cjS0UpuFNgYiu6CdpdpkjlvR2LUHYyWub9j1PwKZocc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qO7XQURIk5RQ5PtdHUCPTANyOcDUi07esJmt4Pyd5dKHNtghJTmCuoTTMku+HyDa1 w/ytKv7pqY9ttoXcbgTGIkn/ea+EtnbNxQdNwZqoKvKMuXwsTknqcfd5Gyj7PjJncO uB/LomjT0GVJvEsEEHAkQgcNjk53zHuYfb8Gdyy0= From: "redi at gcc dot 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 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: redi at gcc dot gnu.org 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 #4 from Jonathan Wakely --- 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>. Arguably, std::format("{:%S}", tp) could work, because it doesn't need to u= se 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 operato= r<< 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.=