Repository navigation
Fix nested_format_specs buffer context construction - #4963
Tyagiquamar wants to merge 2 commits into
Conversation
…mat_specs Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
vitaut
left a comment
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.
basic_format_args is tied to the context type, so a generic_context pack cannot construct a basic_appender context. Nested width formatting now buffers through a context that stores the original pack, and reuses a context that already writes with an appender. Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
|
Thanks, addressed the review feedback in 8f23dec.
Validation:
Ready for another look. |
|
Please don't copy other PRs. This just wastes everyone's time. |
|
Hi Victor, I'd like to clarify the timeline, as I think there may have been a misunderstanding. I originally opened #4963 on October 1, before #4974 was opened on October 5. My October 7 commit addressed the argument-pack mismatch you pointed out in your earlier review. I understand that the final implementations overlap significantly, and I respect your decision to consolidate the work into one PR. However, I didn't intentionally copy another contributor's work, and I wouldn't want to leave that impression. Thanks for your time reviewing this. Verified chronology
PR | Author | Opened (UTC) | Status
-- | -- | -- | --
#4951 | linsen458-spec | September 18, 2026 | Closed, unmerged
#4963 | Tyagiquamar (mine) | October 1, 2026 | Closed, unmerged
#4974 | mayankjaiswal12 | October 5, 2026 | Open
Verified chronology
PR Author Opened (UTC) Status
[#4951](https://github.com//pull/4951) linsen458-spec September 18, 2026 Closed, unmerged
[#4963](https://github.com//pull/4963) Tyagiquamar (mine) October 1, 2026 Closed, unmerged
[#4974](https://github.com//pull/4974) mayankjaiswal12 October 5, 2026 Open
|
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).