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

Workaround bugs in gcc 8 #1959

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions include/fmt/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,11 @@ OutputIt vformat_to(
\endrst
*/
template <typename OutputIt, typename S, typename... Args,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char_t<S>>::value&&
detail::is_string<S>::value)>
inline OutputIt format_to(OutputIt out, const text_style& ts,
const S& format_str, Args&&... args) {
bool enable = (detail::is_output_iterator<OutputIt, char_t<S>>::value&&
detail::is_string<S>::value)>
inline auto format_to(OutputIt out, const text_style& ts,
const S& format_str, Args&&... args) ->
typename std::enable_if<enable, OutputIt>::type {
return vformat_to(out, ts, to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str, args...));
}
Expand Down
16 changes: 8 additions & 8 deletions include/fmt/compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,14 @@ OutputIt format_to(OutputIt out, const S&, const Args&... args) {
return format_to(out, compiled, args...);
}

template <typename OutputIt, typename CompiledFormat, typename... Args,
FMT_ENABLE_IF(detail::is_output_iterator<
OutputIt, typename CompiledFormat::char_type>::value&&
std::is_base_of<detail::basic_compiled_format,
CompiledFormat>::value)>
format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
const CompiledFormat& cf,
const Args&... args) {
template <typename OutputIt, typename CompiledFormat, typename... Args>
typename std::enable_if<(detail::is_output_iterator<
OutputIt, typename CompiledFormat::char_type>::value&&
std::is_base_of<detail::basic_compiled_format,
CompiledFormat>::value),
format_to_n_result<OutputIt>
>::type format_to_n(OutputIt out, size_t n,
const CompiledFormat& cf, const Args&... args) {
auto it =
format_to(detail::truncating_iterator<OutputIt>(out, n), cf, args...);
return {it.base(), it.count()};
Expand Down
15 changes: 8 additions & 7 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1968,10 +1968,11 @@ inline void vprint_mojibake(std::FILE*, string_view, format_args) {}
// GCC 8 and earlier cannot handle std::back_insert_iterator<Container> with
// vformat_to<ArgFormatter>(...) overload, so SFINAE on iterator type instead.
template <typename OutputIt, typename S, typename Char = char_t<S>,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value)>
OutputIt vformat_to(
bool enable = detail::is_output_iterator<OutputIt, Char>::value>
auto vformat_to(
OutputIt out, const S& format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
basic_format_args<buffer_context<type_identity_t<Char>>> args) ->
typename std::enable_if<enable, OutputIt>::type {
decltype(detail::get_buffer<Char>(out)) buf(detail::get_buffer_init(out));
detail::vformat_to(buf, to_string_view(format_str), args);
return detail::get_iterator(buf);
Expand Down Expand Up @@ -2023,10 +2024,10 @@ inline format_to_n_result<OutputIt> vformat_to_n(
\endrst
*/
template <typename OutputIt, typename S, typename... Args,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char_t<S>>::value)>
inline format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
const S& format_str,
const Args&... args) {
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
inline auto format_to_n(OutputIt out, size_t n,
const S& format_str, const Args&... args) ->
typename std::enable_if<enable, format_to_n_result<OutputIt>>::type {
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
return vformat_to_n(out, n, to_string_view(format_str), vargs);
}
Expand Down
8 changes: 4 additions & 4 deletions include/fmt/locale.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ inline OutputIt vformat_to(
}

template <typename OutputIt, typename S, typename... Args,
typename Char = char_t<S>,
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value)>
inline OutputIt format_to(OutputIt out, const std::locale& loc,
const S& format_str, Args&&... args) {
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
inline auto format_to(OutputIt out, const std::locale& loc,
const S& format_str, Args&&... args) ->
typename std::enable_if<enable, OutputIt>::type {
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
return vformat_to(out, loc, to_string_view(format_str), vargs);
}
Expand Down