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

Bugfix for fmt::printf on Power9 architecture with the XL compiler #3256

Merged
merged 8 commits into from
Jan 13, 2023
10 changes: 9 additions & 1 deletion include/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ template <typename Char> class printf_width_handler {
}
};

// Workaround for a bug with the XL compiler when initializing
// printf_arg_formatter's base class.
template <typename Char>
auto make_arg_formatter(buffer_appender<Char> iter, format_specs<Char>& s)
-> arg_formatter<Char> {
return {iter, s, locale_ref()};
}

// The ``printf`` argument formatter.
template <typename OutputIt, typename Char>
class printf_arg_formatter : public arg_formatter<Char> {
Expand All @@ -235,7 +243,7 @@ class printf_arg_formatter : public arg_formatter<Char> {

public:
printf_arg_formatter(OutputIt iter, format_specs<Char>& s, context_type& ctx)
: base{iter, s, locale_ref()}, context_(ctx) {}
: base(make_arg_formatter(iter, s)), context_(ctx) {}

OutputIt operator()(monostate value) { return base::operator()(value); }

Expand Down