Skip to content
Snippets Groups Projects
Unverified Commit 0f52a92a authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

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.
parent 83c6fe13
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment