aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-09-18 17:20:29 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-10-09 13:39:15 +0100
commitb349c651ff16240b8cc4225db76479154c941c28 (patch)
treee14c68336a7672fac624ee4c53d3b551375b4cc6 /gcc
parent55dbb4b5261d3b0d9fb970ffd3c371bd691badea (diff)
downloadgcc-b349c651ff16240b8cc4225db76479154c941c28.zip
gcc-b349c651ff16240b8cc4225db76479154c941c28.tar.gz
gcc-b349c651ff16240b8cc4225db76479154c941c28.tar.bz2
libstdc++: Fix formatting of chrono::duration with character rep [PR116755]
Implement Peter Dimov's suggestion for resolving LWG 4118, which is to use +d.count() so that character types are promoted to an integer type before formatting them. This didn't have unanimous consensus in the committee as Howard Hinnant proposed that we should format the rep consistently with std::format("{}", d.count()) instead. That ends up being more complicated, because it makes std::formattable a precondition of operator<< which was not previously the case, and it means that ios_base::fmtflags from the stream would be ignored because std::format doesn't use them. libstdc++-v3/ChangeLog: PR libstdc++/116755 * include/bits/chrono_io.h (operator<<): Use +d.count() for duration inserter. (__formatter_chrono::_M_format): Likewise for %Q format. * testsuite/20_util/duration/io.cc: Test durations with character types as reps.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions