Fix #2816: strip named argument wrappers for compile-time checking

This commit is contained in:
timsong-cpp
2022-03-17 23:53:48 -05:00
committed by Victor Zverovich
parent c076a54a4d
commit 3d19be282a
2 changed files with 13 additions and 1 deletions

View File

@@ -1816,6 +1816,7 @@ TEST(format_test, compile_time_string) {
"foo"_a = "foo"));
EXPECT_EQ("", fmt::format(FMT_STRING("")));
EXPECT_EQ("", fmt::format(FMT_STRING(""), "arg"_a = 42));
EXPECT_EQ("42", fmt::format(FMT_STRING("{answer}"), "answer"_a = Answer()));
#endif
(void)static_with_null;
@@ -1885,6 +1886,8 @@ TEST(format_test, named_arg_udl) {
fmt::format("{first}{second}{first}{third}", fmt::arg("first", "abra"),
fmt::arg("second", "cad"), fmt::arg("third", 99)),
udl_a);
EXPECT_EQ("42", fmt::format("{answer}", "answer"_a = Answer()));
}
#endif // FMT_USE_USER_DEFINED_LITERALS