]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::format("{}", 'c')
authorJonathan Wakely <jwakely@redhat.com>
Tue, 12 Dec 2023 20:53:08 +0000 (20:53 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 12 Dec 2023 22:33:32 +0000 (22:33 +0000)
commit52de6aa1a8582208b519b6998389d3a801b0de7b
tree22f8131fdc7422f78aaba3541a14207dbaaf72d7
parenta01462ae8bafa86e7df47a252917ba6899d587cf
libstdc++: Fix std::format("{}", 'c')

When I added a fast path for std::format("{}", x) in
r14-5587-g41a5ea4cab2c59 I forgot to handle char separately from other
integral types. That caused std::format("{}", 'c') to return "99"
instead of "c".

libstdc++-v3/ChangeLog:

* include/std/format (__do_vformat_to): Handle char separately
from other integral types.
* testsuite/std/format/functions/format.cc: Check for expected
output for char and bool arguments.
* testsuite/std/format/string.cc: Check that 0 filling is
rejected for character and string formats.
libstdc++-v3/include/std/format
libstdc++-v3/testsuite/std/format/functions/format.cc
libstdc++-v3/testsuite/std/format/string.cc