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;
     }

Reply via email to