[Issue 2154] Correct error when building with IBM's latest XLC (#2155)

* [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ý <martin.horenovsky@gmail.com>
This commit is contained in:
Rob Boehne 2021-01-21 15:50:49 -06:00 committed by GitHub
parent bcb9ea8cb5
commit 68975e3ff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,8 @@ namespace {
return lhs == rhs; return lhs == rhs;
} }
auto ulpDiff = std::abs(lc - rc); // static cast as a workaround for IBM XLC
auto ulpDiff = std::abs(static_cast<FP>(lc - rc));
return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff; return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff;
} }
@ -234,4 +235,3 @@ Floating::WithinRelMatcher WithinRel(float target) {
} // namespace Matchers } // namespace Matchers
} // namespace Catch } // namespace Catch