diff --git a/include/fmt/format.h b/include/fmt/format.h index 59b8077b..03db92f2 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2299,6 +2299,13 @@ FMT_CONSTEXPR20 bool isfinite(T value) { if (is_constant_evaluated()) return value - value == 0; return std::isfinite(value); } +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wfloat-equal" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif template ::value)> constexpr bool isfinite(T value) { return value - value == 0; // std::isfinite doesn't support __float128. @@ -2307,6 +2314,11 @@ constexpr bool isfinite(T value) { template constexpr bool isnan(T value) { return value != value; // std::isnan doesn't support __float128. } +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif template ::value)> FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { diff --git a/test/xchar-test.cc b/test/xchar-test.cc index 4386e8b9..390588cb 100644 --- a/test/xchar-test.cc +++ b/test/xchar-test.cc @@ -479,9 +479,21 @@ template struct formatter, charT> { fmt::runtime("{:" + specs + "}"), c.imag()); auto fill_align_width = std::string(); if (specs_.width > 0) fill_align_width = fmt::format(">{}", specs_.width); +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wfloat-equal" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif return format_to(ctx.out(), runtime("{:" + fill_align_width + "}"), c.real() != 0 ? fmt::format("({}+{}i)", real, imag) : fmt::format("{}i", imag)); +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } }; FMT_END_NAMESPACE