Skip to content
Snippets Groups Projects
Commit 02ca9d3f authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Fix std::basic_format_arg::handle for BasicFormatters

std::basic_format_arg::handle is supposed to format its value as const
if that is valid, to reduce the number of instantiations of the
formatter's format function. I made a silly typo so that it checks
formattable_with<TD, Context> not formattable_with<const TD, Context>,
which breaks support for BasicFormatters i.e. ones that can only format
non-const types.

There's a static_assert in the handle constructor which is supposed to
improve diagnostics for trying to format a const argument with a
formatter that doesn't support it. That condition can't fail, because
the std::basic_format_arg constructor is already constrained to check
that the argument type is formattable. The static_assert can be removed.

libstdc++-v3/ChangeLog:

	* include/std/format (basic_format_arg::handle::__maybe_const_t):
	Fix condition to check if const type is formattable.
	(basic_format_arg::handle::handle(T&)): Remove redundant
	static_assert.
	* testsuite/std/format/formatter/basic.cc: New test.
parent f5cdda8a
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