Fix FMT_COMPILE failure with format_as mapped types (Issue #4794) (#4836)

This commit is contained in:
AMAN UPADHYAY
2026-07-12 21:51:55 +05:30
committed by GitHub
parent 1a99c2630c
commit af2d9f2b78
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -479,3 +479,13 @@ TEST(compile_test, constexpr_string_format) {
EXPECT_TRUE(big);
}
#endif // FMT_USE_CONSTEXPR_STRING
namespace {
struct compile_format_as_type {
int value;
};
int format_as(compile_format_as_type f) { return f.value; }
}
TEST(compile_test, format_as) {
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), compile_format_as_type{42}));
}