From a6e8ed15c47798d36b2e9160a6c0ad9970d84a1f Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 11 May 2019 08:58:34 -0700 Subject: [PATCH] Disable UDL templates on GCC 9 by default (#1148) --- include/fmt/format.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 5efbd2dc21bb..977310b69d7e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -148,15 +148,18 @@ FMT_END_NAMESPACE # endif #endif -// EDG C++ Front End based compilers (icc, nvcc) do not currently support UDL -// templates. -#if FMT_USE_USER_DEFINED_LITERALS && FMT_ICC_VERSION == 0 && \ - FMT_CUDA_VERSION == 0 && \ - ((FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L) || \ - (defined(FMT_CLANG_VERSION) && FMT_CLANG_VERSION >= 304)) -# define FMT_UDL_TEMPLATE 1 -#else -# define FMT_UDL_TEMPLATE 0 +#ifndef FMT_USE_UDL_TEMPLATE +// EDG front end based compilers (icc, nvcc) do not support UDL templates yet +// and GCC 9 warns about them. +# if FMT_USE_USER_DEFINED_LITERALS && FMT_ICC_VERSION == 0 && \ + FMT_CUDA_VERSION == 0 && \ + ((FMT_GCC_VERSION >= 600 && FMT_GCC_VERSION <= 900 && \ + __cplusplus >= 201402L) || \ + (defined(FMT_CLANG_VERSION) && FMT_CLANG_VERSION >= 304)) +# define FMT_USE_UDL_TEMPLATE 1 +# else +# define FMT_USE_UDL_TEMPLATE 0 +# endif #endif #if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_trailing_return) || \ @@ -3570,7 +3573,7 @@ inline std::size_t formatted_size(string_view format_str, const Args&... args) { #if FMT_USE_USER_DEFINED_LITERALS namespace internal { -# if FMT_UDL_TEMPLATE +# if FMT_USE_UDL_TEMPLATE template class udl_formatter { public: template @@ -3593,7 +3596,7 @@ template struct udl_formatter { return format(str, std::forward(args)...); } }; -# endif // FMT_UDL_TEMPLATE +# endif // FMT_USE_UDL_TEMPLATE template struct udl_arg { const Char* str; @@ -3606,7 +3609,7 @@ template struct udl_arg { } // namespace internal inline namespace literals { -# if FMT_UDL_TEMPLATE +# if FMT_USE_UDL_TEMPLATE template FMT_CONSTEXPR internal::udl_formatter operator""_format() { return {}; @@ -3630,7 +3633,7 @@ inline internal::udl_formatter operator"" _format(const wchar_t* s, std::size_t) { return {s}; } -# endif // FMT_UDL_TEMPLATE +# endif // FMT_USE_UDL_TEMPLATE /** \rst