forked from apache/avro
-
Notifications
You must be signed in to change notification settings - Fork 0
3815: MINOR: [C++] fix missing format_context when compiled with C++23 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martin-augment
wants to merge
2
commits into
main
Choose a base branch
from
pr-3815-2026-06-10-07-56-31
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| The AI agents should never link to any issue or a pull request | ||
| in any GitHub repository in the code reviews! | ||
|
|
||
| The AI agents should not review AI agents' config files like CLAUDE.md or AGENTS.md! | ||
|
|
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Does C++23 require std::formatter specializations to use a template FormatContext parameter instead of std::format_context in the format method signature?💡 Result:
No, C++23 does not require std::formatter specializations to use a template FormatContext parameter in the format method signature [1]. The standard requirements for a formatter specialization [2][1] specify that the format method must accept a context object of type std::basic_format_context<OutputIt, CharT> [3][2][1]. In practice, you may either explicitly use the concrete type (such as std::format_context) [4][5] or use a template parameter to make the formatter more generic [6][1]. Specifically, the Formatter requirements [1] state that given a formatter object f, an lvalue arg of type Arg, and an lvalue fc of type basic_format_context<OutputIt, CharT>, the expression f.format(arg, fc) must be valid and return an object of type basic_format_context<OutputIt, CharT>::iterator [2][1]. Because std::format_context is a type alias for std::basic_format_context<std::back_insert_iteratorstd::string, char> (or the wide character equivalent) [3][7], using it in your signature restricts your formatter to that specific context [4][5]. Using a template parameter for the context allows your formatter to work with different output iterators and contexts [6][1], but it is not a requirement imposed by the standard [1]. You are free to write the signature as: auto format(const T& val, std::format_context& ctx) const; or template auto format(const T& val, FormatContext& ctx) const; Both are valid, provided they meet the semantic requirements of the Formatter interface [2][1].
Citations:
Clarify C++23
std::formatter::formatsignature requirements (optional change)C++23 doesn’t require the
formatmethod to use a templatedFormatContext&; the requirement is that it accepts astd::basic_format_context<OutputIt, CharT>&—std::format_contextis an allowed concrete alias. Forlang/c++/include/avro/Node.hh:228-231, ensure the C++23 build failure you’re targeting is actually caused by theformatsignature mismatch (otherwise the template generalization is just an optional flexibility improvement).🤖 Prompt for AI Agents