From d61fe3ecc3c953cc92abdbbd25eae09b62c60849 Mon Sep 17 00:00:00 2001 From: Rob Boehne Date: Thu, 21 Jan 2021 15:50:49 -0600 Subject: [PATCH] [Issue 2154] Correct error when building with IBM's latest XLC (#2155) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Issue 2154] Correct error when building with IBM's latest XLC compiler with xlclang++ front-end. On AIX, the XLC 16.1.0.1 compiler considers the call to `std::abs` ambigious, so it needs help with a static_cast to the type of the template argument. Co-authored-by: Martin Hořeňovský --- src/catch2/matchers/catch_matchers_floating_point.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp index fc5d9165..b3c1c335 100644 --- a/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -54,7 +54,8 @@ namespace { return lhs == rhs; } - auto ulpDiff = std::abs(lc - rc); + // static cast as a workaround for IBM XLC + auto ulpDiff = std::abs(static_cast(lc - rc)); return static_cast(ulpDiff) <= maxUlpDiff; }