[Bug libstdc++/125482] std::chrono::parse doesn't fail for invalid dates like Nov 31 12:65:65

"redi at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125482

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We do fail for 12:65:65 and 24:00:00 but due to a typo/thinko we accept
12:60:59

--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -4745,7 +4745,7 @@ namespace __detail
                      __h = hours(__val);

                      __val = __read_unsigned(2);
-                     if (__val == -1 || __val > 60) [[unlikely]]
+                     if (__val == -1 || __val > 59) [[unlikely]]
                        if ((_M_need & _ChronoParts::_TimeOfDay) != 0)
                          {
                            __err |= ios_base::failbit;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.