libstdc++: Disable std::formatter<char8_t, C> specialization
commit0f52a92ab249bde64b7570d4cf549437a3283520
authorJonathan Wakely <jwakely@redhat.com>
Fri, 20 Sep 2024 16:26:35 +0000 (20 17:26 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 22 Sep 2024 16:52:36 +0000 (22 17:52 +0100)
treeb128beac89a80ad8424237c8e7d90aa0a87443a5
parent83c6fe130a00c6c28cfffcc787a0a719966adfaf
libstdc++: Disable std::formatter<char8_t, C> specialization

I noticed that char8_t was missing from the list of types that were
prevented from using the std::formatter partial specialization for
integer types. That partial specialization was also matching
cv-qualified integer types, because std::integral<const int> is true.

This change simplifies the constraints by introducing a new variable
template which is only true for cv-unqualified integer types, with
explicit specializations to exclude the character types. This should be
slightly more efficient than the previous constraints that checked
std::integral<T> and (!__is_one_of<T, char, wchar_t, ...>). It also
avoids the need for a separate std::formatter specialization for 128-bit
integers, as they can be handled by the new variable template too.

libstdc++-v3/ChangeLog:

* include/std/format (__format::__is_formattable_integer): New
variable template and specializations.
(template<integral, __char> struct formatter): Replace
constraints on first arg with __is_formattable_integer.
* testsuite/std/format/formatter/requirements.cc: Check that
std::formatter specializations for char8_t and const int are
disabled.
libstdc++-v3/include/std/format
libstdc++-v3/testsuite/std/format/formatter/requirements.cc