From 28607bbeb247b33fd120209fd478b41ef4ac9367 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Mon, 18 Apr 2022 19:21:19 +0500 Subject: [PATCH] Suppress a -Wliteral-range warning on Apple M1 --- test/format-test.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/format-test.cc b/test/format-test.cc index 7d81e6009be9e..04a93375a6783 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -13,6 +13,7 @@ #include "fmt/format.h" // clang-format on +#include // LDBL_MANT_DIG #include // uint32_t #include // INT_MAX @@ -1006,12 +1007,12 @@ TEST(format_test, precision) { EXPECT_THAT(outputs, testing::Contains(fmt::format("{:.838A}", -2.14001164E+38))); - if (std::numeric_limits::digits == 64) { - auto ld = (std::numeric_limits::min)(); - EXPECT_EQ(fmt::format("{:.0}", ld), "3e-4932"); - EXPECT_EQ(fmt::format("{:0g}", 5.02957084971264961283E-4940L), - "5.02957e-4940"); - } +#if LDBL_MANT_DIG == 64 + auto ld = (std::numeric_limits::min)(); + EXPECT_EQ(fmt::format("{:.0}", ld), "3e-4932"); + EXPECT_EQ(fmt::format("{:0g}", 5.02957084971264961283E-4940L), + "5.02957e-4940"); +#endif EXPECT_EQ("123.", fmt::format("{:#.0f}", 123.0)); EXPECT_EQ("1.23", fmt::format("{:.02f}", 1.234));