[Bug libstdc++/126543] chrono::parse should accept "60" seconds for a utc_time that is a valid leap second

"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=126543

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -3937,7 +3937,11 @@ namespace __detail
          // "23:59:60" to correctly produce a time within a leap second.
          auto __ut = utc_clock::from_sys(__p._M_sys_days) + __p._M_time
                        - *__offset;
-         __tp = __detail::__round<_Duration>(__ut);
+         if (__p._M_is_leap_second
+               && !chrono::get_leap_second_info(__ut).is_leap_second)
+           __is.setstate(ios_base::failbit);
+         else
+           __tp = __detail::__round<_Duration>(__ut);
        }
       return __is;
     }
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.