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

This commit is contained in:
Kenny Weiss 2023-01-13 11:36:00 -08:00 committed by GitHub
parent 676c2a107e
commit bfc0924eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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> {
@ -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); }