diff --git a/include/fmt/core.h b/include/fmt/core.h index 3ddb3b4a..fd53cfbe 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -155,8 +155,10 @@ Type(const Type &) FMT_DELETED; \ void operator=(const Type &) FMT_DELETED -#if (FMT_HAS_INCLUDE() && __cplusplus > 201402L) || \ - (defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) +// libc++ supports string_view in pre-c++17. +#if (FMT_HAS_INCLUDE() && \ + (__cplusplus > 201402L || _LIBCPP_VERSION)) || \ + (defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) # include # define FMT_USE_STD_STRING_VIEW // std::experimental::basic_string_view::remove_prefix isn't constexpr until diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 9a189844..15bdf7b9 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -540,6 +540,10 @@ struct printf_context { std::back_insert_iterator, typename Buffer::value_type> type; }; +template +inline arg_store::type, Args...> make_printf_args(const Args & ... args) { + return arg_store::type, Args...>(args...); +} typedef basic_format_args::type> printf_args; inline std::string vsprintf(string_view format, printf_args args) { diff --git a/test/compile-test/CMakeLists.txt b/test/compile-test/CMakeLists.txt index cebcee01..ede0c3ce 100644 --- a/test/compile-test/CMakeLists.txt +++ b/test/compile-test/CMakeLists.txt @@ -48,10 +48,10 @@ endfunction () expect_compile("") # Formatting a wide character with a narrow format string is forbidden. -expect_compile_error("fmt::format(\"{}\", L'a';") +expect_compile_error("fmt::format(\"{}\", L'a');") # Formatting a wide string with a narrow format string is forbidden. -expect_compile_error("fmt::format(\"{}\", L\"foo\";") +expect_compile_error("fmt::format(\"{}\", L\"foo\");") # Make sure that compiler features detected in the header # match the features detected in CMake. diff --git a/test/format-test.cc b/test/format-test.cc index 0ea41c83..8c35dc43 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1201,7 +1201,7 @@ TEST(FormatterTest, FormatStringView) { } #ifdef FMT_USE_STD_STRING_VIEW -TEST(FormatterTest, FormatStringView) { +TEST(FormatterTest, FormatStdStringView) { EXPECT_EQ("test", format("{0}", std::string_view("test"))); } #endif