Fix nested_format_specs buffer context construction - #4963
Open
Tyagiquamar wants to merge 1 commit into
Open
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
…mat_specs Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
vitaut
requested changes
Oct 3, 2026
vitaut
left a comment
Contributor
There was a problem hiding this comment.
This seems to move the mismatch from the output iterator to the argument pack. ctx.args() has type basic_format_args<FormatContext>, while the new buffer context expects basic_format_args<basic_format_context<basic_appender<Char>, Char>>, and there is no conversion between those when FormatContext is a generic_context.
Could you add the exact #4949 reproducer to compile-test.cc? I believe this still fails to instantiate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
nested_format_specs::write,buffer_ctxwas constructed directly asFormatContext(basic_appender<Char>(buf), ctx.args(), ctx.locale()). WhenFormatContextis not parameterized withbasic_appender<Char>(such as when custom contexts or different output iterators are passed, e.g. during compilation/custom formatters with nested formatted ranges likestd::arrayor tuples), attempting to constructFormatContextdirectly withbasic_appender<Char>leads to template instantiation and iterator mismatch errors (#4949).Solution
basic_format_context<basic_appender<Char>, Char>for the temporary buffer context innested_format_specs::write().Validation
ranges-test(42/42 tests) andcompile-test(19/19 tests).