Fix handling of pointers in format string compilation and FMT_BUILTIN_TYPES=0

This commit is contained in:
Victor Zverovich
2025-12-07 07:23:19 -08:00
parent a6e871e39b
commit 19e4d5ecd9
2 changed files with 13 additions and 4 deletions

View File

@@ -7,9 +7,10 @@
#include "gtest/gtest.h"
#if !defined(__GNUC__) || __GNUC__ >= 5
#if !defined(__GNUC__) || (__GNUC__ >= 5 || defined(__clang__))
# define FMT_BUILTIN_TYPES 0
# include "fmt/format.h"
# include "fmt/compile.h"
TEST(no_builtin_types_test, format) {
EXPECT_EQ(fmt::format("{}", 42), "42");
@@ -22,4 +23,9 @@ TEST(no_builtin_types_test, double_is_custom_type) {
EXPECT_EQ(fmt::format_args(args).get(0).type(),
fmt::detail::type::custom_type);
}
TEST(no_builtin_types_test, format_pointer_compiled) {
const void* p = nullptr;
fmt::format(FMT_COMPILE("{:} {}"), 42, p);
}
#endif