From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3CFEA3858D20; Tue, 5 Mar 2024 15:53:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CFEA3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709654020; bh=Q40gKiFWZAMqANLFtw1wOw+1ZYP1yLcd8GCYJNxltsE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XOD5gSFAyiVgT1qwX2xWyEzxh4xqNXyB1JV4lwBAw9T1OWk7Wo2I9QZ0XiEpYSg4u mumARihRksiKHRUCun0+1DUMg60/fJz/tbIJRWhZBTm8EVjCDddT6+fSnUO6U3T8qI nsg5Bjl0VnZTPAYRNJCrrEz1xDNk1Sz/xwvtyvPU= From: "redi at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.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: --- 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=3D114240 --- Comment #3 from Jonathan Wakely --- 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 =3D &__off; using __format::_ChronoParts; auto __need =3D _ChronoParts::_Year | _ChronoParts::_Month - | _ChronoParts::_Day | _ChronoParts::_TimeOfDay; + | _ChronoParts::_Day; + if constexpr (ratio_less_v) + __need |=3D _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.=