]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Add std::formatter specializations for extended float types
authorJonathan Wakely <jwakely@redhat.com>
Mon, 7 Aug 2023 13:06:59 +0000 (14:06 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 17 Aug 2023 19:24:18 +0000 (20:24 +0100)
commit6cf214b4fc97f5320fff8f4d5d262ef858f34a8d
tree60a765a4b888c5e37831ebfc3cc20f5680f4ded3
parent1a566fddea212a6a8e4484f7843d8e5d39b5bff0
libstdc++: Add std::formatter specializations for extended float types

This makes it possible to format _Float32, _Float64 etc. in C++20 mode.
Previously it was only possible to format them in C++23 when the
<stdfloat> typedefs and the std::to_chars overloads were defined.

Instead of relying on std::to_chars for those types, we can just reuse
the formatters for float, double and long double. This also avoids
template bloat by reusing the same specializations instead of
instantiating __formatter_fp for every different type.

libstdc++-v3/ChangeLog:

* include/std/format (formatter): Add partial specializations
for extended floating-point types.
* testsuite/std/format/functions/format.cc: Move test_float128()
to ...
* testsuite/std/format/formatter/ext_float.cc: New test.
libstdc++-v3/include/std/format
libstdc++-v3/testsuite/std/format/formatter/ext_float.cc [new file with mode: 0644]
libstdc++-v3/testsuite/std/format/functions/format.cc
This page took 0.056351 seconds and 5 git commands to generate.