Skip to content

Commit 66d2730

Browse files
committed
Move FMT_USE_CONSTEVAL check to FMT_STRING directly
1 parent 54f7d6d commit 66d2730

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/fmt/format.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4228,7 +4228,7 @@ class format_int {
42284228
inline auto str() const -> std::string { return {str_, size()}; }
42294229
};
42304230

4231-
#if FMT_USE_CONSTEVAL || FMT_CLANG_ANALYZER
4231+
#if FMT_CLANG_ANALYZER
42324232
# define FMT_STRING_IMPL(s, base) s
42334233
#else
42344234
# define FMT_STRING_IMPL(s, base) \
@@ -4257,7 +4257,11 @@ class format_int {
42574257
* // A compile-time error because 'd' is an invalid specifier for strings.
42584258
* std::string s = fmt::format(FMT_STRING("{:d}"), "foo");
42594259
*/
4260-
#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4260+
#if FMT_USE_CONSTEVAL
4261+
# define FMT_STRING(s) s
4262+
#else
4263+
# define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4264+
#endif // FMT_USE_CONSTEVAL
42614265

42624266
FMT_API auto vsystem_error(int error_code, string_view fmt, format_args args)
42634267
-> std::system_error;

0 commit comments

Comments
 (0)