public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/114240] sys_days not being parsed with only a date in the stream
Date: Tue, 05 Mar 2024 15:53:40 +0000	[thread overview]
Message-ID: <bug-114240-4-iXaetcAijj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114240-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114240

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So this would fix it:

--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -2826,7 +2826,9 @@ namespace __detail
        __offset = &__off;
       using __format::_ChronoParts;
       auto __need = _ChronoParts::_Year | _ChronoParts::_Month
-                   | _ChronoParts::_Day | _ChronoParts::_TimeOfDay;
+                   | _ChronoParts::_Day;
+      if constexpr (ratio_less_v<typename _Duration::period, days::period>)
+       __need |= _ChronoParts::_TimeOfDay;
       __detail::_Parser_t<_Duration> __p(__need);
       if (__p(__is, __fmt, __abbrev, __offset))
        {

A similar fix is needed for the from_stream overload for local_time, but
utc_time, gps_time and tai_time will be fixed by changing the sys_time
overload.

  parent reply	other threads:[~2024-03-05 15:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 15:11 [Bug libstdc++/114240] New: " howard.hinnant at gmail dot com
2024-03-05 15:21 ` [Bug libstdc++/114240] " redi at gcc dot gnu.org
2024-03-05 15:25 ` redi at gcc dot gnu.org
2024-03-05 15:31 ` howard.hinnant at gmail dot com
2024-03-05 15:53 ` redi at gcc dot gnu.org [this message]
2024-03-06 21:28 ` redi at gcc dot gnu.org
2024-03-07  0:10 ` redi at gcc dot gnu.org
2024-03-08 10:45 ` redi at gcc dot gnu.org
2024-03-09  0:29 ` cvs-commit at gcc dot gnu.org
2024-03-09  0:33 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114240-4-iXaetcAijj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).