From 54f7d6d91bf7a8503bc19887466e367f670652cf Mon Sep 17 00:00:00 2001 From: friedkeenan Date: Thu, 20 Nov 2025 13:30:10 -0600 Subject: [PATCH 1/2] Make FMT_STRING redundant when FMT_USE_CONSTEVAL is enabled --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 0f38f30efe27..8658e1186096 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4228,7 +4228,7 @@ class format_int { inline auto str() const -> std::string { return {str_, size()}; } }; -#if FMT_CLANG_ANALYZER +#if FMT_USE_CONSTEVAL || FMT_CLANG_ANALYZER # define FMT_STRING_IMPL(s, base) s #else # define FMT_STRING_IMPL(s, base) \ From 66d2730fa12f92b065e78af729718d9cb0d42e8a Mon Sep 17 00:00:00 2001 From: friedkeenan Date: Fri, 21 Nov 2025 09:12:33 -0600 Subject: [PATCH 2/2] Move FMT_USE_CONSTEVAL check to FMT_STRING directly --- include/fmt/format.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 8658e1186096..d8f59046750b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4228,7 +4228,7 @@ class format_int { inline auto str() const -> std::string { return {str_, size()}; } }; -#if FMT_USE_CONSTEVAL || FMT_CLANG_ANALYZER +#if FMT_CLANG_ANALYZER # define FMT_STRING_IMPL(s, base) s #else # define FMT_STRING_IMPL(s, base) \ @@ -4257,7 +4257,11 @@ class format_int { * // A compile-time error because 'd' is an invalid specifier for strings. * std::string s = fmt::format(FMT_STRING("{:d}"), "foo"); */ -#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string) +#if FMT_USE_CONSTEVAL +# define FMT_STRING(s) s +#else +# define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string) +#endif // FMT_USE_CONSTEVAL FMT_API auto vsystem_error(int error_code, string_view fmt, format_args args) -> std::system_error;