We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
<format>
next_arg_id
When user-defined formatter calls next_arg_id and format-spec is empty we will get compiler error.
Example:
#include <print> struct FormatNextArg {}; template <> struct std::formatter<FormatNextArg> { public: template <class ParseContext> constexpr auto parse(ParseContext &ctx) { auto it = ctx.begin(); if (it != ctx.end() && *it != '}') { throw std::format_error{"Expected empty spec"}; } arg_id = ctx.next_arg_id(); return it; } template <class FormatContext> auto format(FormatNextArg, FormatContext &ctx) const { return std::format_to(ctx.out(), "arg-id: {}", arg_id); } private: size_t arg_id; }; int main() { // std::println("{}, {}", FormatNextArg{}, 0, FormatNextArg{}, "1"); // Does not compile since VS 17.10 std::println("{:}, {:}", FormatNextArg{}, 2, FormatNextArg{}, "3"); // Works, replacement field is not empty }
Introduced by: #4078 Compiler explorer (VS 17.9): https://godbolt.org/z/rsje4j1hP
The text was updated successfully, but these errors were encountered:
Address microsoft#4636
c931c77
Successfully merging a pull request may close this issue.
When user-defined formatter calls
next_arg_id
and format-spec is empty we will get compiler error.Example:
Introduced by: #4078
Compiler explorer (VS 17.9): https://godbolt.org/z/rsje4j1hP
The text was updated successfully, but these errors were encountered: