https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116755

--- Comment #7 from Zartaj Majeed <zmajeed at sbcglobal dot net> ---
Thanks for looking at these issues and providing the references - these shed
light on my issue 2

>From a simple user point of view, issue 2 is wrong output from libstdc++ - and
libc++ if Andrew is right

It may be right by the standard - until P3154R1 is approved - to me it's a
defect in the standard that allows this behavior to be implemented for duration

Isn't a major selling point of "{}" specifiers for print to "do the right
thing" - to allow a user to print values without worrying about type,
underlying type or object layout?

I could be sympathetic to current behavior if I were printing raw int8_t - but
I'm printing a duration and clearly the duration is 54 seconds not 6 seconds -
I picked 54 to point out an especially pernicious case - the incorrect output
easily passes an eyeball test - or a parser expecting a valid duration

Still, both issues are corner cases - and have workarounds - any attention is
welcomed

A duration_cast<seconds>(d2) prevents issue 2 - duration_cast to a bigger
representation type also prevents issue 1 but obviously you're out of luck with
int64_t

Reply via email to