From 401f0873944fca21eaa32fd31dfab24e6a0b1358 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 10 Jan 2024 06:52:12 -0800 Subject: [PATCH] Fix write_uintptr_fallback --- include/fmt/format.h | 2 +- test/format-test.cc | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 550f607c..ebf85210 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -464,7 +464,7 @@ template constexpr auto num_bits() -> int { } // std::numeric_limits::digits may return 0 for 128-bit ints. template <> constexpr auto num_bits() -> int { return 128; } -template <> constexpr auto num_bits() -> int { return 128; } +template <> constexpr auto num_bits() -> int { return 128; } // A heterogeneous bit_cast used for converting 96-bit long double to uint128_t // and 128-bit pointers to uint128_fallback. diff --git a/test/format-test.cc b/test/format-test.cc index ad4d7a73..223fb1b3 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1561,14 +1561,13 @@ TEST(format_test, format_pointer) { TEST(format_test, write_uintptr_fallback) { // Test that formatting a pointer by converting it to uint128_fallback works. // This is needed to support systems without uintptr_t. - // TODO - /*auto s = std::string(); + auto s = std::string(); fmt::detail::write_ptr( std::back_inserter(s), fmt::detail::bit_cast( reinterpret_cast(0xface)), nullptr); - EXPECT_EQ(s, "0xface");*/ + EXPECT_EQ(s, "0xface"); } enum class color { red, green, blue };