Conditionalise result of FMT_STRING_IMPL for gcc 9.

This commit is contained in:
Dair Grant 2020-03-06 22:45:15 +00:00
parent 566ef6ef95
commit 2807732878

View File

@ -3544,17 +3544,24 @@ FMT_CONSTEXPR internal::udl_arg<wchar_t> operator"" _a(const wchar_t* s,
#endif // FMT_USE_USER_DEFINED_LITERALS #endif // FMT_USE_USER_DEFINED_LITERALS
FMT_END_NAMESPACE FMT_END_NAMESPACE
#define FMT_STRING_IMPL(s, ...) \ #if FMT_GCC_VERSION >= 900
[]() -> fmt::basic_string_view<fmt::remove_cvref_t<decltype(*s)>> { \ # define FMT_STRING_RESULT(s) ()->fmt::basic_string_view<fmt::remove_cvref_t<decltype(*s)>>
/* Use a macro-like name to avoid shadowing warnings. */ \ #else
struct FMT_COMPILE_STRING : fmt::compile_string { \ # define FMT_STRING_RESULT(s)
__VA_ARGS__ FMT_CONSTEXPR \ #endif
operator fmt::basic_string_view<fmt::remove_cvref_t<decltype(*s)>>() const { \
/* FMT_STRING only accepts string literals. */ \ #define FMT_STRING_IMPL(s, ...) \
return fmt::internal::literal_to_view(s); \ [] FMT_STRING_RESULT(s) { \
} \ /* Use a macro-like name to avoid shadowing warnings. */ \
}; \ struct FMT_COMPILE_STRING : fmt::compile_string { \
return FMT_COMPILE_STRING(); \ using char_type = fmt::remove_cvref_t<decltype(*s)>; \
__VA_ARGS__ FMT_CONSTEXPR \
operator fmt::basic_string_view<char_type>() const { \
/* FMT_STRING only accepts string literals. */ \
return fmt::internal::literal_to_view(s); \
} \
}; \
return FMT_COMPILE_STRING(); \
}() }()
/** /**