Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-17 11:21:17 +0200
committerMartin Hořeňovský2019-10-17 16:40:37 +0200
commit31906d83ec1fff2b667a32a0730c649d12889ef6 (patch)
tree417ce14bd88616290bb975e68c9d036c352c038a /include
parent91fa55303b4aae109939ead5ca2ccc94b1f2e044 (diff)
downloadcatch3-31906d83ec1fff2b667a32a0730c649d12889ef6.tar.gz
Add parenthesis to prevent macro expansions of min/max
Closes #1772
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_matchers_floating.cpp4
-rw-r--r--include/internal/catch_random_number_generator.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/include/internal/catch_matchers_floating.cpp b/include/internal/catch_matchers_floating.cpp
index be969397..cdc0f0cb 100644
--- a/include/internal/catch_matchers_floating.cpp
+++ b/include/internal/catch_matchers_floating.cpp
@@ -142,7 +142,7 @@ namespace Floating {
WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType)
:m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
CATCH_ENFORCE(m_type == FloatingPointKind::Double
- || m_ulps < std::numeric_limits<uint32_t>::max(),
+ || m_ulps < (std::numeric_limits<uint32_t>::max)(),
"Provided ULP is impossibly large for a float comparison.");
}
@@ -201,7 +201,7 @@ namespace Floating {
}
bool WithinRelMatcher::match(double const& matchee) const {
- const auto relMargin = m_epsilon * std::max(std::fabs(matchee), std::fabs(m_target));
+ const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target));
return marginComparison(matchee, m_target,
std::isinf(relMargin)? 0 : relMargin);
}
diff --git a/include/internal/catch_random_number_generator.h b/include/internal/catch_random_number_generator.h
index 3f0d6d38..79d62794 100644
--- a/include/internal/catch_random_number_generator.h
+++ b/include/internal/catch_random_number_generator.h
@@ -20,10 +20,10 @@ namespace Catch {
using state_type = std::uint64_t;
public:
using result_type = std::uint32_t;
- static constexpr result_type min() {
+ static constexpr result_type (min)() {
return 0;
}
- static constexpr result_type max() {
+ static constexpr result_type (max)() {
return static_cast<result_type>(-1);
}