Workaround clang/gcc incompatibility

This commit is contained in:
Victor Zverovich 2021-07-02 11:34:42 -07:00
parent 00a57a9f8f
commit 3e7a29cc92
5 changed files with 13 additions and 13 deletions

View File

@ -507,7 +507,7 @@ void vformat_to(buffer<Char>& buf, const text_style& ts,
auto background = detail::make_background_color<Char>(ts.get_background());
buf.append(background.begin(), background.end());
}
detail::vformat_to(buf, format_str, args);
detail::vformat_to(buf, format_str, args, {});
if (has_style) detail::reset_color<Char>(buf);
}

View File

@ -2734,7 +2734,7 @@ template <typename Char>
void vformat_to(
buffer<Char>& buf, basic_string_view<Char> fmt,
basic_format_args<FMT_BUFFER_CONTEXT(type_identity_t<Char>)> args,
detail::locale_ref loc = {});
locale_ref loc = {});
FMT_API void vprint_mojibake(std::FILE*, string_view, format_args);
#ifndef _WIN32
@ -2892,7 +2892,7 @@ template <typename OutputIt,
auto vformat_to(OutputIt out, string_view fmt, format_args args) -> OutputIt {
using detail::get_buffer;
auto&& buf = get_buffer<char>(out);
detail::vformat_to(buf, string_view(fmt), args);
detail::vformat_to(buf, string_view(fmt), args, {});
return detail::get_iterator(buf);
}
@ -2929,7 +2929,7 @@ auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args)
using buffer =
detail::iterator_buffer<OutputIt, char, detail::fixed_buffer_traits>;
auto buf = buffer(out, n);
detail::vformat_to(buf, fmt, args);
detail::vformat_to(buf, fmt, args, {});
return {buf.out(), buf.count()};
}
@ -2951,7 +2951,7 @@ FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string<T...> fmt,
template <typename... T>
FMT_INLINE auto formatted_size(format_string<T...> fmt, T&&... args) -> size_t {
auto buf = detail::counting_buffer<>();
detail::vformat_to(buf, string_view(fmt), fmt::make_format_args(args...));
detail::vformat_to(buf, string_view(fmt), fmt::make_format_args(args...), {});
return buf.count();
}

View File

@ -2624,9 +2624,10 @@ auto to_string(const basic_memory_buffer<Char, SIZE>& buf)
FMT_BEGIN_DETAIL_NAMESPACE
template <typename Char>
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
basic_format_args<buffer_context<type_identity_t<Char>>> args,
locale_ref loc) {
void vformat_to(
buffer<Char>& buf, basic_string_view<Char> fmt,
basic_format_args<FMT_BUFFER_CONTEXT(type_identity_t<Char>)> args,
locale_ref loc) {
// workaround for msvc bug regarding name-lookup in module
// link names into function scope
using detail::arg_formatter;
@ -2706,10 +2707,6 @@ void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
}
#ifndef FMT_HEADER_ONLY
extern template void vformat_to(detail::buffer<char>&, string_view,
basic_format_args<format_context>,
detail::locale_ref);
extern template FMT_API auto thousands_sep_impl<char>(locale_ref)
-> thousands_sep_result<char>;
extern template FMT_API auto thousands_sep_impl<wchar_t>(locale_ref)

View File

@ -142,7 +142,7 @@ FMT_DEPRECATED auto format_to(basic_memory_buffer<Char, SIZE, Allocator>& buf,
const S& format_str, Args&&... args) ->
typename buffer_context<Char>::iterator {
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
detail::vformat_to(buf, to_string_view(format_str), vargs);
detail::vformat_to(buf, to_string_view(format_str), vargs, {});
return detail::buffer_appender<Char>(buf);
}

View File

@ -47,6 +47,9 @@ template FMT_API char detail::decimal_point_impl(locale_ref);
template FMT_API void detail::buffer<char>::append(const char*, const char*);
// DEPRECATED!
// There is no correspondent extern template in format.h because of
// incompatibility between clang and gcc (#2377).
template FMT_API void detail::vformat_to(
detail::buffer<char>&, string_view,
basic_format_args<FMT_BUFFER_CONTEXT(char)>, detail::locale_ref);