diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h index 618a2509..ad69f772 100644 --- a/include/internal/catch_decomposer.h +++ b/include/internal/catch_decomposer.h @@ -10,6 +10,7 @@ #include "catch_tostring.h" #include "catch_stringref.h" +#include "catch_meta.hpp" #include @@ -143,6 +144,20 @@ namespace Catch { return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; } + template + auto operator && ( RhsT const& ) -> BinaryExpr const { + static_assert(always_false::value, + "operator&& is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template + auto operator || ( RhsT const& ) -> BinaryExpr const { + static_assert(always_false::value, + "operator|| is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + auto makeUnaryExpr() const -> UnaryExpr { return UnaryExpr{ m_lhs }; } diff --git a/include/internal/catch_meta.hpp b/include/internal/catch_meta.hpp index 43ba30fb..e69c4955 100644 --- a/include/internal/catch_meta.hpp +++ b/include/internal/catch_meta.hpp @@ -9,6 +9,8 @@ #ifndef TWOBLUECUBES_CATCH_META_HPP_INCLUDED #define TWOBLUECUBES_CATCH_META_HPP_INCLUDED +#include + template< typename... > struct TypeList{}; @@ -73,4 +75,7 @@ struct combine }; }; +template +struct always_false : std::false_type {}; + #endif // TWOBLUECUBES_CATCH_META_HPP_INCLUDED