From 31bed1bb6584e726e9537e9efd1ab19fbcf370ba Mon Sep 17 00:00:00 2001 From: Justin Riddell Date: Thu, 16 Oct 2025 19:25:19 +0100 Subject: [PATCH] Fix module fmt::join (#4577) FMT_USE_STRING_VIEW define was incorrectly not being defined when using modules, so there was no appropriate formatter specialization for std::string_view Fixes #4379 --- include/fmt/format.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 5333eb51..0cd3a232 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -40,6 +40,12 @@ #include "base.h" +// libc++ supports string_view in pre-c++17. +#if FMT_HAS_INCLUDE() && \ + (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) +# define FMT_USE_STRING_VIEW +#endif + #ifndef FMT_MODULE # include // malloc, free @@ -62,11 +68,8 @@ # include // std::bit_cast # endif -// libc++ supports string_view in pre-c++17. -# if FMT_HAS_INCLUDE() && \ - (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) +# if defined(FMT_USE_STRING_VIEW) # include -# define FMT_USE_STRING_VIEW # endif # if FMT_MSC_VERSION