KEMBAR78
fix: Make basic_format_arg::visit() const by nebkat · Pull Request #4043 · fmtlib/fmt · GitHub
Skip to content

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
@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