You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JMazurkiewicz
changed the title
[libc++][format] Negation of INT_MIN (UB) when formatting chrono::duration
[libc++][format] Negation of LLONG_MIN (UB) when formatting chrono::durationJan 18, 2023
The result of formatting a std::chrono::duration instance holding a negative value, or an hh_mm_ss object h for which h.is_negative() is true, is equivalent to the output of the corresponding positive value, with a STATICALLY-WIDEN<charT>("-") character sequence placed before the replacement of the initial conversion specifier[.](http://www.eelis.net/c++draft/time.format#4.sentence-1)
There is no corresponding positive value for the minimum value. I'll investigate it later in more detail.
Example:
Expected output:
-9223372036854775808
Got:
--9223372036854775808
Compiler explorer: https://godbolt.org/z/cvcYsTbM8
Similar issue in MSVC STL: microsoft/STL#1902
Comparison with fmtlib: https://godbolt.org/z/YEvPYWKTb
The text was updated successfully, but these errors were encountered: