fix OPERATOR_LITERAL marco bug for gcc7 compiler

This commit is contained in:
Aengus.Jiang 2025-06-27 12:02:58 +08:00
parent f40f93a40d
commit 2fa816a1a8

View File

@ -73,10 +73,10 @@
# endif
#endif // FMT_MODULE
#if (defined(__GNUC__) && __GNUC__ < 5) || defined(_MSC_VER)
# define OPERATOR_LITERAL(suffix) operator"" suffix
#if (defined(__GNUC__) && __GNUC__ < 5)
# define OPERATOR_LITERAL(suffix) operator"" _##suffix
#else
# define OPERATOR_LITERAL(suffix) operator""suffix
# define OPERATOR_LITERAL(suffix) operator""_##suffix
#endif
#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)
@ -4056,7 +4056,7 @@ template <typename T, typename Char = char> struct nested_formatter {
inline namespace literals {
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
template <detail::fixed_string S> constexpr auto OPERATOR_LITERAL(_a)() {
template <detail::fixed_string S> constexpr auto OPERATOR_LITERAL(a)() {
using char_t = remove_cvref_t<decltype(*S.data)>;
return detail::udl_arg<char_t, sizeof(S.data) / sizeof(char_t), S>();
}
@ -4069,7 +4069,7 @@ template <detail::fixed_string S> constexpr auto OPERATOR_LITERAL(_a)() {
* using namespace fmt::literals;
* fmt::print("The answer is {answer}.", "answer"_a=42);
*/
constexpr auto OPERATOR_LITERAL(_a)(const char* s, size_t) -> detail::udl_arg<char> {
constexpr auto OPERATOR_LITERAL(a)(const char* s, size_t) -> detail::udl_arg<char> {
return {s};
}
#endif // FMT_USE_NONTYPE_TEMPLATE_ARGS