From 483eddc8516b008f096f2200825325e2de54c7de Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 29 Jan 2026 16:31:06 -0800 Subject: [PATCH] Merge workarounds for MSVC bugs --- include/fmt/base.h | 11 +++-------- include/fmt/format.h | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index ddfb879f..174bcba2 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -126,8 +126,8 @@ # define FMT_USE_CONSTEVAL 0 #elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L # define FMT_USE_CONSTEVAL 0 // consteval is broken in Apple clang < 14. -#elif FMT_MSC_VERSION && FMT_MSC_VERSION < 1929 -# define FMT_USE_CONSTEVAL 0 // consteval is broken in MSVC VS2019 < 16.10. +#elif FMT_MSC_VERSION && FMT_MSC_VERSION < 1940 +# define FMT_USE_CONSTEVAL 0 // consteval is broken in some MSVC2022 versions. #elif defined(__cpp_consteval) # define FMT_USE_CONSTEVAL 1 #elif FMT_GCC_VERSION >= 1002 || FMT_CLANG_VERSION >= 1101 @@ -1834,12 +1834,7 @@ template class buffer { /// Appends data to the end of the buffer. template -// Workaround for MSVC2019 to fix error C2893: Failed to specialize function -// template 'void fmt::v11::detail::buffer::append(const U *,const U *)'. -#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1940 - FMT_CONSTEXPR20 -#endif - void append(const U* begin, const U* end) { + FMT_CONSTEXPR20 void append(const U* begin, const U* end) { while (begin != end) { auto size = size_; auto free_cap = capacity_ - size; diff --git a/include/fmt/format.h b/include/fmt/format.h index 6bff3e0a..93d5965f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -979,7 +979,7 @@ FMT_API void print(FILE*, string_view); namespace detail { template struct fixed_string { - FMT_CONSTEXPR20 fixed_string(const Char (&s)[N]) { + FMT_CONSTEXPR fixed_string(const Char (&s)[N]) { detail::copy(static_cast(s), s + N, data); }