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

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2018-01-12 15:43:56 +0100
committerMartin Hořeňovský2018-01-12 15:49:56 +0100
commitde36b2ada6e4593a9a32c4c86cd47d4bc002b148 (patch)
treec850ec5703f0b1600a7964892f4ecd875e28ac26 /include
parent9700ee4fc0f90a4dfc99818ed2d78ce1fc06ee8c (diff)
downloadcatch3-de36b2ada6e4593a9a32c4c86cd47d4bc002b148.tar.gz
Fix compilation for types where relops don't return bool
Closes #1147
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_decomposer.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h
index d663114b..4fe15c4a 100644
--- a/include/internal/catch_decomposer.h
+++ b/include/internal/catch_decomposer.h
@@ -82,7 +82,7 @@ namespace Catch {
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
template<typename LhsT, typename RhsT>
- auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return lhs == rhs; };
+ auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); };
template<typename T>
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
template<typename T>
@@ -93,7 +93,7 @@ namespace Catch {
auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
template<typename LhsT, typename RhsT>
- auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
+ auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); };
template<typename T>
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
template<typename T>
@@ -128,19 +128,19 @@ namespace Catch {
template<typename RhsT>
auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
- return { m_lhs > rhs, m_lhs, ">", rhs };
+ return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
}
template<typename RhsT>
auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
- return { m_lhs < rhs, m_lhs, "<", rhs };
+ return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
}
template<typename RhsT>
auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
- return { m_lhs >= rhs, m_lhs, ">=", rhs };
+ return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
}
template<typename RhsT>
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
- return { m_lhs <= rhs, m_lhs, "<=", rhs };
+ return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
}
auto makeUnaryExpr() const -> UnaryExpr<LhsT> {