Skip to content

Commit b27a615

Browse files
committed
Move FMT_USE_CONSTEVAL check to FMT_STRING directly
1 parent 270480d commit b27a615

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
@@ -4231,7 +4231,7 @@ class format_int {
42314231
inline auto str() const -> std::string { return {str_, size()}; }
42324232
};
42334233

4234-
#if FMT_USE_CONSTEVAL || FMT_CLANG_ANALYZER
4234+
#if FMT_CLANG_ANALYZER
42354235
# define FMT_STRING_IMPL(s, base) s
42364236
#else
42374237
# define FMT_STRING_IMPL(s, base) \
@@ -4260,7 +4260,11 @@ class format_int {
42604260
* // A compile-time error because 'd' is an invalid specifier for strings.
42614261
* std::string s = fmt::format(FMT_STRING("{:d}"), "foo");
42624262
*/
4263-
#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4263+
#if FMT_USE_CONSTEVAL
4264+
# define FMT_STRING(s) s
4265+
#else
4266+
# define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4267+
#endif // FMT_USE_CONSTEVAL
42644268

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

0 commit comments

Comments
 (0)