]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/testsuite/std/format/functions/format.cc
libstdc++: Fix std::format("{}", negative_integer) [PR114325]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 13 Mar 2024 21:19:54 +0000 (21:19 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 14 Mar 2024 16:58:15 +0000 (16:58 +0000)
commitf89cfdb2f2e9b4fe517b1e00511c4d70a7014cbc
tree67f1c557476d23df6e42eaa80f009ba6ae43cc8f
parentdf483ebd24689a3bebfae2089637a00eca0e5a12
libstdc++: Fix std::format("{}", negative_integer) [PR114325]

The fast path for "{}" format strings has a bug for negative integers
where the length passed to std::to_chars is too long.

libstdc++-v3/ChangeLog:

PR libstdc++/114325
* include/std/format (_Scanner::_M_scan): Pass correct length to
__to_chars_10_impl.
* testsuite/std/format/functions/format.cc: Check negative
integers with empty format-spec.
libstdc++-v3/include/std/format
libstdc++-v3/testsuite/std/format/functions/format.cc