Skip to content

Commit

Permalink
[Issue 2154] Correct error when building with IBM's latest XLC (#2155)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
datalogics-robb and horenmar authored Jan 21, 2021
1 parent bcb9ea8 commit 68975e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/internal/catch_matchers_floating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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<FP>(lc - rc));
return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff;
}

Expand Down Expand Up @@ -234,4 +235,3 @@ Floating::WithinRelMatcher WithinRel(float target) {

} // namespace Matchers
} // namespace Catch

0 comments on commit 68975e3

Please sign in to comment.