From 6f41e18c1e0c1ecfe2a35888f4f4f517aeee728a Mon Sep 17 00:00:00 2001 From: "Aengus.Jiang" Date: Fri, 27 Jun 2025 10:49:23 +0800 Subject: [PATCH] compatible for c++11 but GCC < 5 --- include/spdlog/fmt/bundled/format.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index 50e57144..08d12626 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -72,6 +72,12 @@ # endif #endif // FMT_MODULE +#if (defined(__GNUC__) && __GNUC__ < 5) || defined(_MSC_VER) +# define OPERATOR_LITERAL(suffix) operator"" suffix +#else +# define OPERATOR_LITERAL(suffix) operator""suffix +#endif + #if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS) // Use the provided definition. #elif defined(__NVCOMPILER) @@ -3993,7 +3999,7 @@ template struct nested_formatter { inline namespace literals { #if FMT_USE_NONTYPE_TEMPLATE_ARGS -template constexpr auto operator""_a() { +template constexpr auto OPERATOR_LITERAL(_a)() { using char_t = remove_cvref_t; return detail::udl_arg(); } @@ -4006,7 +4012,7 @@ template constexpr auto operator""_a() { * using namespace fmt::literals; * fmt::print("The answer is {answer}.", "answer"_a=42); */ -constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg { +constexpr auto OPERATOR_LITERAL(_a)(const char* s, size_t) -> detail::udl_arg { return {s}; } #endif // FMT_USE_NONTYPE_TEMPLATE_ARGS