Skip to content

Commit

Permalink
Bugfix for fmt::printf on Power9 architecture with the XL compiler (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyweiss authored Jan 13, 2023
1 parent 676c2a1 commit bfc0924
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit bfc0924

Please sign in to comment.