From 1653244c6990fd58b753971879ece30e3287e655 Mon Sep 17 00:00:00 2001 From: mocabe Date: Tue, 4 Jun 2019 00:34:27 +0900 Subject: [PATCH] Fix compilation issue on VS2019 (#1186) (#1191) --- include/fmt/core.h | 5 +++-- include/fmt/format-inl.h | 3 ++- include/fmt/format.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 58c716d8..7e22c166 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -204,9 +204,10 @@ FMT_BEGIN_NAMESPACE template using enable_if_t = typename std::enable_if::type; -// An enable_if helper to be used in template parameters which results in much +// enable_if helpers to be used in template parameters which results in much // shorter symbols: https://godbolt.org/z/sWw4vP. -#define FMT_ENABLE_IF(...) enable_if_t<__VA_ARGS__, int> = 0 +// Also include fix for VS2019 compilation issue (see #1140 and #1186). +#define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 namespace internal { diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index fa5eb6f3..8778337e 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -674,7 +674,8 @@ template struct grisu_shortest_handler { } }; -template > +template > FMT_API bool grisu_format(Double value, buffer& buf, int precision, unsigned options, int& exp) { FMT_ASSERT(value >= 0, "value is negative"); diff --git a/include/fmt/format.h b/include/fmt/format.h index 82f7092d..f1c623cc 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2246,7 +2246,7 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view s, } template ::value, int>> + enable_if_t<(is_compile_string::value), int>> void check_format_string(S format_str) { typedef typename S::char_type char_t; FMT_CONSTEXPR_DECL bool invalid_format =