diff --git a/include/fmt/core.h b/include/fmt/core.h index 847cf11b..c028b1df 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1007,7 +1007,7 @@ template class basic_format_arg { template friend FMT_CONSTEXPR basic_format_arg internal::make_arg( - const named_arg_base& value); + const internal::named_arg_base& value); template friend FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis, diff --git a/include/fmt/dyn-args.h b/include/fmt/dyn-args.h index 285b9bf5..849cf4c2 100644 --- a/include/fmt/dyn-args.h +++ b/include/fmt/dyn-args.h @@ -36,7 +36,7 @@ struct is_string_view, Char> #ifdef FMT_USE_EXPERIMENTAL_STRING_VIEW template -struct is_string_view, Char> +struct is_string_view, Char> : std::true_type{}; #endif diff --git a/test/format-dyn-args-test.cc b/test/format-dyn-args-test.cc index 1ef14d1a..1ea2991e 100644 --- a/test/format-dyn-args-test.cc +++ b/test/format-dyn-args-test.cc @@ -26,7 +26,7 @@ TEST(FormatDynArgsTest, StringsAndRefs) { char str[]{"1234567890"}; store.push_back(str); store.push_back(std::cref(str)); - store.push_back(std::string_view{str}); + store.push_back(fmt::string_view{str}); str[0] = 'X'; std::string result = fmt::vformat( @@ -76,7 +76,8 @@ TEST(FormatDynArgsTest, CustomFormat) { TEST(FormatDynArgsTest, NamedArgByRef) { fmt::dynamic_format_arg_store store; auto a1 = fmt::arg("a1_", 42); - store.push_back(std::cref(a1)); + auto ref = std::cref(a1); + store.push_back(ref); std::string result = fmt::vformat( "{a1_}", // and {} and {}", @@ -106,6 +107,8 @@ TEST(FormatDynArgsTest, NamedStrings) { EXPECT_EQ("1234567890 and X234567890", result); } +#ifdef FMT_HAS_VARIANT + TEST(FormatDynArgsTest, NamedCustomFormat) { fmt::dynamic_format_arg_store store; Custom c{}; @@ -122,3 +125,5 @@ TEST(FormatDynArgsTest, NamedCustomFormat) { EXPECT_EQ("cust=0 and cust=1 and cust=3", result); } + +#endif // FMT_HAS_VARIANT