Skip to content
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

fix: Make basic_format_arg::visit() const #4043

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

nebkat
Copy link
Contributor

@nebkat nebkat commented Jul 1, 2024

https://github.com/fmtlib/fmt/blob/24c1f886afc35278ba95556345adcb9804f4c4f1/include/fmt/base.h#L1812C1-L1816C2

visit_format_arg accepts a const basic_format_arg & and forwards to basic_format_arg::visit() which is not const.

template <typename Visitor, typename Context>
FMT_DEPRECATED FMT_CONSTEXPR auto visit_format_arg(
    Visitor&& vis, const basic_format_arg<Context>& arg) -> decltype(vis(0)) {
  return arg.visit(static_cast<Visitor&&>(vis));
}

Not sure if this is the correct fix, but causing issues in pre-11 formatters still using visit_format_arg.

@vitaut vitaut merged commit c4f6fa7 into fmtlib:master Jul 1, 2024
43 checks passed
@vitaut
Copy link
Contributor

vitaut commented Jul 1, 2024

Thanks for the fix!

@nebkat nebkat deleted the fix-visit-const branch July 1, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants