aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2025-05-15 19:32:01 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2025-05-19 10:44:35 +0100
commit1ed7585bf60ba9940ca5dc6d2c72dba86eea7b4d (patch)
treea2ea4de23119feb1b7d6b15224fc1023f6e1677d /libstdc++-v3/testsuite/std
parent7fabbf3562812f648bb49d0a7ea6b74e88defd4b (diff)
downloadgcc-1ed7585bf60ba9940ca5dc6d2c72dba86eea7b4d.zip
gcc-1ed7585bf60ba9940ca5dc6d2c72dba86eea7b4d.tar.gz
gcc-1ed7585bf60ba9940ca5dc6d2c72dba86eea7b4d.tar.bz2
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>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
-rw-r--r--libstdc++-v3/testsuite/std/time/clock/local/io.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/std/time/clock/local/io.cc b/libstdc++-v3/testsuite/std/time/clock/local/io.cc
index b4d562f..67818e8 100644
--- a/libstdc++-v3/testsuite/std/time/clock/local/io.cc
+++ b/libstdc++-v3/testsuite/std/time/clock/local/io.cc
@@ -89,6 +89,9 @@ test_format()
s = std::format("{}", local_seconds{});
VERIFY( s == "1970-01-01 00:00:00" );
+
+ s = std::format("{}", local_days{}); // PR libstdc++/120293
+ VERIFY( s == "1970-01-01" );
}
void