From 8cc1108f2b8aa215c94f1d6d3b93121d28ffd08a Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 26 Jun 2015 06:35:33 +0100 Subject: [PATCH] Use <= operator instead of ->* for decomposer Allows more complex LHS expressions - and works around an Eclipse bug. See Issues #359, #393 and #247 for details --- include/internal/catch_capture.hpp | 2 +- include/internal/catch_result_builder.h | 8 ++++---- .../CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 58591265..7bfef0e1 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -33,7 +33,7 @@ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ try { \ - ( __catchResult->*expr ).endExpression(); \ + ( __catchResult <= expr ).endExpression(); \ } \ catch( ... ) { \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ diff --git a/include/internal/catch_result_builder.h b/include/internal/catch_result_builder.h index 3963c26d..b44882bb 100644 --- a/include/internal/catch_result_builder.h +++ b/include/internal/catch_result_builder.h @@ -41,8 +41,8 @@ namespace Catch { ResultDisposition::Flags resultDisposition ); template - ExpressionLhs operator->* ( T const& operand ); - ExpressionLhs operator->* ( bool value ); + ExpressionLhs operator <= ( T const& operand ); + ExpressionLhs operator <= ( bool value ); template ResultBuilder& operator << ( T const& value ) { @@ -93,11 +93,11 @@ namespace Catch { namespace Catch { template - inline ExpressionLhs ResultBuilder::operator->* ( T const& operand ) { + inline ExpressionLhs ResultBuilder::operator <= ( T const& operand ) { return ExpressionLhs( *this, operand ); } - inline ExpressionLhs ResultBuilder::operator->* ( bool value ) { + inline ExpressionLhs ResultBuilder::operator <= ( bool value ) { return ExpressionLhs( *this, value ); } diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj index 9afd9bdf..b64ceef1 100644 --- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj @@ -688,6 +688,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; WARNING_CFLAGS = ( "-Weverything", + "-Wparentheses", "-Wno-disabled-macro-expansion", ); }; @@ -705,6 +706,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; WARNING_CFLAGS = ( "-Weverything", + "-Wparentheses", "-Wno-disabled-macro-expansion", ); };