diff --git a/include/fmt/color.h b/include/fmt/color.h index a1ee3b03..9537e070 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -266,6 +266,10 @@ template <> inline void reset_color(FILE *stream) FMT_NOEXCEPT { fputs(internal::data::WRESET_COLOR, stream); } + +template +struct is_format_string: std::integral_constant< + bool, std::is_empty>::value> {}; } // namespace internal template < diff --git a/include/fmt/core.h b/include/fmt/core.h index 2bb8cd06..acbddf1a 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -216,6 +216,14 @@ FMT_CONSTEXPR size_t length(const Char *s) { FMT_CONSTEXPR size_t length(const char *s) { return std::strlen(s); } #endif +#if FMT_GCC_VERSION && FMT_GCC_VERSION < 405 +template +struct is_constructible: std::false_type {}; +#else +template +struct is_constructible: std::is_constructible {}; +#endif + template struct no_formatter_error : std::false_type {}; } // namespace internal @@ -644,7 +652,7 @@ inline typename std::enable_if< template inline typename std::enable_if< - std::is_constructible, T>::value, + internal::is_constructible, T>::value, init, string_type>>::type make_value(const T &val) { return basic_string_view(val); } @@ -652,7 +660,7 @@ template inline typename std::enable_if< !convert_to_int::value && !std::is_convertible>::value && - !std::is_constructible, T>::value, + !internal::is_constructible, T>::value, // Implicit conversion to std::string is not handled here because it's // unsafe: https://github.com/fmtlib/fmt/issues/729 init>::type @@ -1253,11 +1261,10 @@ namespace internal { // If S is a format string type, format_string_traints::char_type gives its // character type. template -struct format_string_traits { - private: - // Use constructability as a way to detect if format_string_traits is - // specialized because other methods are broken on MSVC2013. - format_string_traits(); +class format_string_traits { + // Use emptyness as a way to detect if format_string_traits is + // specialized because other methods are broken on MSVC2013 or gcc 4.4. + int dummy; }; template @@ -1285,11 +1292,6 @@ struct format_string_traits< basic_string_view, S>::value>::type> : format_string_traits_base {}; -template -struct is_format_string : - std::integral_constant< - bool, std::is_constructible>::value> {}; - template struct is_compile_string : std::integral_constant::value> {};