Namespace qualify calls to get

This commit is contained in:
Victor Zverovich
2021-10-09 06:43:48 -07:00
parent 9c14474d30
commit dcd282bb26
2 changed files with 24 additions and 4 deletions

View File

@@ -59,6 +59,23 @@ TEST(compile_test, compile_fallback) {
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), 42));
}
struct type_with_get {
template <int> friend void get(type_with_get);
};
FMT_BEGIN_NAMESPACE
template <> struct formatter<type_with_get> : formatter<int> {
template <typename FormatContext>
auto format(type_with_get, FormatContext& ctx) -> decltype(ctx.out()) {
return formatter<int>::format(42, ctx);
}
};
FMT_END_NAMESPACE
TEST(compile_test, compile_type_with_get) {
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), type_with_get()));
}
#ifdef __cpp_if_constexpr
struct test_formattable {};