public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "howard.hinnant at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114240] New: sys_days not being parsed with only a date in the stream Date: Tue, 05 Mar 2024 15:11:45 +0000 [thread overview] Message-ID: <bug-114240-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114240 Bug ID: 114240 Summary: sys_days not being parsed with only a date in the stream Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: howard.hinnant at gmail dot com Target Milestone: --- #include <chrono> #include <iostream> #include <sstream> int main(int argc, char**argv){ std::istringstream ssStart{"2024-01-01"}; std::istringstream ssEnd("2024-02-01"); ssStart.exceptions(std::ios::failbit); std::chrono::sys_days tStart, tEnd; ssStart >> std::chrono::parse("%Y-%m-%d ", tStart); ssEnd >> std::chrono::parse("%Y-%m-%d ", tEnd); auto tDays = tEnd-tStart; std::cout << ssStart.str() << "," << ssEnd.str() << "," << tDays.count() << std::endl; } Expected output: 2024-01-01,2024-02-01,31 Actual output: terminate called after throwing an instance of 'std::__ios_failure' what(): basic_ios::clear: iostream error I expected this function: http://eel.is/c++draft/time.clock.system.nonmembers#6 to successfully parse the days-precision time_point because there is sufficient information in the stream to form a valid date. Demo: https://wandbox.org/permlink/FrtMteIddnb4ogpZ
next reply other threads:[~2024-03-05 15:11 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-05 15:11 howard.hinnant at gmail dot com [this message] 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 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@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: linkBe 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).