From 9b3189fce04b6990eebbf7fde713a1819ccc8420 Mon Sep 17 00:00:00 2001 From: kentsangkm Date: Thu, 26 Mar 2015 19:50:54 +0800 Subject: [PATCH] Resolved #359 Eclipse indexer did not handle the ->* operator correctly and display error in the editor, whereas it actually is not a bug. Changing the operator from operator->* to operator+ can resolve this problem. Proof of concept: Prority 3 operator+ Right-to-left Prority 4 operator->* Left-to-right where: __catchResult+expr Supported operator in expr: Prority 3 + Prority 3 - Prority 3 / Prority 3 * Prority 13 && *STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison Prority 14 || *STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison __catchResult + _1Obj operand1 _2Obj .... _NObj => (__catchResult + _1Obj) operand1 _2Obj .... _NObj => ExpressionLhs operand1 _2Obj .... _NObj Hence, the change is OK --- include/internal/catch_capture.hpp | 2 +- include/internal/catch_result_builder.h | 8 ++++---- single_include/catch.hpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 1285b31f..0cbc2e85 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..9b8bc691 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/single_include/catch.hpp b/single_include/catch.hpp index 6b8dfb5e..21376fa7 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -724,8 +724,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 ) { @@ -1301,11 +1301,11 @@ private: 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 ); } @@ -1475,7 +1475,7 @@ namespace Catch { do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ try { \ - ( __catchResult->*expr ).endExpression(); \ + ( __catchResult+expr ).endExpression(); \ } \ catch( ... ) { \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \