]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::format of chrono::local_days with {} [PR120293]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 15 May 2025 18:32:01 +0000 (19:32 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 19 May 2025 09:44:35 +0000 (10:44 +0100)
commit1ed7585bf60ba9940ca5dc6d2c72dba86eea7b4d
treea2ea4de23119feb1b7d6b15224fc1023f6e1677d
parent7fabbf3562812f648bb49d0a7ea6b74e88defd4b
libstdc++: Fix std::format of chrono::local_days with {} [PR120293]

Formatting of chrono::local_days with an empty chrono-specs should be
equivalent to inserting it into an ostream, which should use the
overload for inserting chrono::sys_days into an ostream. The
implementation of empty chrono-specs in _M_format_to_ostream takes some
short cuts, and that wasn't being done correctly for chrono::local_days.

libstdc++-v3/ChangeLog:

PR libstdc++/120293
* include/bits/chrono_io.h (_M_format_to_ostream): Add special
case for local_time convertible to local_days.
* testsuite/std/time/clock/local/io.cc: Check formatting of
chrono::local_days.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/chrono_io.h
libstdc++-v3/testsuite/std/time/clock/local/io.cc