]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/testsuite/std/format/functions/format.cc
libstdc++: Fix P2510R3 "Formatting pointers" [PR110149]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 8 Jun 2023 20:35:21 +0000 (21:35 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 9 Jun 2023 12:08:25 +0000 (13:08 +0100)
commit628ba410b9265dbd4278c1f1b1fadf05348adef2
treee620ade9ff35d46f0ec594cc5dabd94da0a0eb08
parent960de5dd886572711ef86fa1e15e30d3810eccb9
libstdc++: Fix P2510R3 "Formatting pointers" [PR110149]

I had intended to support the P2510R3 proposal unconditionally in C++20
mode, but I left it half implemented. The parse function supported the
new extensions, but the format function didn't.

This adds the missing pieces, and makes it only enabled for C++26 and
non-strict modes.

libstdc++-v3/ChangeLog:

PR libstdc++/110149
* include/std/format (formatter<const void*, charT>::parse):
Only alow 0 and P for C++26 and non-strict modes.
(formatter<const void*, charT>::format): Use toupper for P
type, and insert zero-fill characters for 0 option.
* testsuite/std/format/functions/format.cc: Check pointer
formatting. Only check P2510R3 extensions conditionally.
* testsuite/std/format/parse_ctx.cc: Only check P2510R3
extensions conditionally.
libstdc++-v3/include/std/format
libstdc++-v3/testsuite/std/format/functions/format.cc
libstdc++-v3/testsuite/std/format/parse_ctx.cc