Skip to content

Commit 31bed1b

Browse files
authored
Fix module fmt::join<string_view> (#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
1 parent 8eebb43 commit 31bed1b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

include/fmt/format.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040

4141
#include "base.h"
4242

43+
// libc++ supports string_view in pre-c++17.
44+
#if FMT_HAS_INCLUDE(<string_view>) && \
45+
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
46+
# define FMT_USE_STRING_VIEW
47+
#endif
48+
4349
#ifndef FMT_MODULE
4450
# include <stdlib.h> // malloc, free
4551

@@ -62,11 +68,8 @@
6268
# include <bit> // std::bit_cast
6369
# endif
6470

65-
// libc++ supports string_view in pre-c++17.
66-
# if FMT_HAS_INCLUDE(<string_view>) && \
67-
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
71+
# if defined(FMT_USE_STRING_VIEW)
6872
# include <string_view>
69-
# define FMT_USE_STRING_VIEW
7073
# endif
7174

7275
# if FMT_MSC_VERSION

0 commit comments

Comments
 (0)