Workaround a bug in gcc

This commit is contained in:
Victor Zverovich 2020-07-07 06:06:50 -07:00
parent a29a01d304
commit fbf3b943cc
3 changed files with 11 additions and 6 deletions

View File

@ -1360,6 +1360,10 @@ using buffer_context =
using format_context = buffer_context<char>;
using wformat_context = buffer_context<wchar_t>;
// Workaround a bug in gcc: https://stackoverflow.com/q/62767544/471164.
#define FMT_BUFFER_CONTEXT(Char) \
basic_format_context<std::back_insert_iterator<detail::buffer<Char>>, Char>
/**
\rst
An array of references to arguments. It can be implicitly converted into
@ -1768,9 +1772,9 @@ std::basic_string<Char> vformat(
std::string vformat(string_view format_str, format_args args);
template <typename Char>
typename buffer_context<Char>::iterator vformat_to(
typename FMT_BUFFER_CONTEXT(Char)::iterator vformat_to(
buffer<Char>& buf, basic_string_view<Char> format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args);
basic_format_args<FMT_BUFFER_CONTEXT(type_identity_t<Char>)> args);
template <typename Char, typename Args,
FMT_ENABLE_IF(!std::is_same<Char, char>::value)>

View File

@ -3482,9 +3482,9 @@ extern template int snprintf_float<long double>(long double value,
template <typename S, typename Char = char_t<S>,
FMT_ENABLE_IF(detail::is_string<S>::value)>
inline typename buffer_context<Char>::iterator vformat_to(
inline typename FMT_BUFFER_CONTEXT(Char)::iterator vformat_to(
detail::buffer<Char>& buf, const S& format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
basic_format_args<FMT_BUFFER_CONTEXT(type_identity_t<Char>)> args) {
return detail::vformat_to(buf, to_string_view(format_str), args);
}

View File

@ -44,8 +44,9 @@ template FMT_API char detail::decimal_point_impl(locale_ref);
template FMT_API void detail::buffer<char>::append(const char*, const char*);
template FMT_API format_context::iterator detail::vformat_to(
detail::buffer<char>&, string_view, basic_format_args<format_context>);
template FMT_API FMT_BUFFER_CONTEXT(char)::iterator detail::vformat_to(
detail::buffer<char>&, string_view,
basic_format_args<FMT_BUFFER_CONTEXT(char)>);
template FMT_API int detail::snprintf_float(double, int, detail::float_specs,
detail::buffer<char>&);