From aaedae60b41121da6c2d0e362f8a6bba2b420e00 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 17 Aug 2017 16:46:05 +0100 Subject: [PATCH] Fixed issue with comparing non-copyable values --- include/internal/catch_decomposer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h index 6d20be78..8cb4c1d4 100644 --- a/include/internal/catch_decomposer.h +++ b/include/internal/catch_decomposer.h @@ -76,14 +76,14 @@ namespace Catch { // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) template - auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; }; + auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast( lhs ) == rhs; }; template auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; template auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; template - auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; }; + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast( lhs ) != rhs; }; template auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; template