diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-03-08 16:15:57 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-03-09 00:21:42 +0000 |
commit | 3e8ee03edd018eed43444755f601cdb9d5931654 (patch) | |
tree | 0001f51fa1f7d4710dd49d7810c66a1a9577e2ce /gcc | |
parent | f4a52c184d608325c14338b57f464f7d0bbc7526 (diff) | |
download | gcc-3e8ee03edd018eed43444755f601cdb9d5931654.zip gcc-3e8ee03edd018eed43444755f601cdb9d5931654.tar.gz gcc-3e8ee03edd018eed43444755f601cdb9d5931654.tar.bz2 |
libstdc++: Do not require a time-of-day when parsing sys_days [PR114240]
When parsing a std::chrono::sys_days (or a sys_time with an even longer
period) we should not require a time-of-day to be present in the input,
because we can't represent that in the result type anyway.
Rather than trying to decide which specializations should require a
time-of-date and which should not, follow the direction of Howard
Hinnant's date library, which allows extracting a sys_time of any period
from input that only contains a date, defaulting the time-of-day part to
00:00:00. This seems consistent with the intent of the standard, which
says it's an error "If the parse fails to decode a valid date" (i.e., it
doesn't care about decoding a valid time, only a date).
libstdc++-v3/ChangeLog:
PR libstdc++/114240
* include/bits/chrono_io.h (_Parser::operator()): Assume
hours(0) for a time_point, so that a time is not required
to be present.
* testsuite/std/time/parse/114240.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions