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<T>        operand1 _2Obj .... _NObj
Hence, the change is OK
This commit is contained in:
kentsangkm 2015-03-26 19:50:54 +08:00
parent 463981554d
commit 9b3189fce0
3 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \ try { \
( __catchResult->*expr ).endExpression(); \ ( __catchResult+expr ).endExpression(); \
} \ } \
catch( ... ) { \ catch( ... ) { \
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \

View File

@ -41,8 +41,8 @@ namespace Catch {
ResultDisposition::Flags resultDisposition ); ResultDisposition::Flags resultDisposition );
template<typename T> template<typename T>
ExpressionLhs<T const&> operator->* ( T const& operand ); ExpressionLhs<T const&> operator+ ( T const& operand );
ExpressionLhs<bool> operator->* ( bool value ); ExpressionLhs<bool> operator+ ( bool value );
template<typename T> template<typename T>
ResultBuilder& operator << ( T const& value ) { ResultBuilder& operator << ( T const& value ) {
@ -93,11 +93,11 @@ namespace Catch {
namespace Catch { namespace Catch {
template<typename T> template<typename T>
inline ExpressionLhs<T const&> ResultBuilder::operator->* ( T const& operand ) { inline ExpressionLhs<T const&> ResultBuilder::operator+ ( T const& operand ) {
return ExpressionLhs<T const&>( *this, operand ); return ExpressionLhs<T const&>( *this, operand );
} }
inline ExpressionLhs<bool> ResultBuilder::operator->* ( bool value ) { inline ExpressionLhs<bool> ResultBuilder::operator+ ( bool value ) {
return ExpressionLhs<bool>( *this, value ); return ExpressionLhs<bool>( *this, value );
} }

View File

@ -724,8 +724,8 @@ namespace Catch {
ResultDisposition::Flags resultDisposition ); ResultDisposition::Flags resultDisposition );
template<typename T> template<typename T>
ExpressionLhs<T const&> operator->* ( T const& operand ); ExpressionLhs<T const&> operator+ ( T const& operand );
ExpressionLhs<bool> operator->* ( bool value ); ExpressionLhs<bool> operator+ ( bool value );
template<typename T> template<typename T>
ResultBuilder& operator << ( T const& value ) { ResultBuilder& operator << ( T const& value ) {
@ -1301,11 +1301,11 @@ private:
namespace Catch { namespace Catch {
template<typename T> template<typename T>
inline ExpressionLhs<T const&> ResultBuilder::operator->* ( T const& operand ) { inline ExpressionLhs<T const&> ResultBuilder::operator+ ( T const& operand ) {
return ExpressionLhs<T const&>( *this, operand ); return ExpressionLhs<T const&>( *this, operand );
} }
inline ExpressionLhs<bool> ResultBuilder::operator->* ( bool value ) { inline ExpressionLhs<bool> ResultBuilder::operator+ ( bool value ) {
return ExpressionLhs<bool>( *this, value ); return ExpressionLhs<bool>( *this, value );
} }
@ -1475,7 +1475,7 @@ namespace Catch {
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \ try { \
( __catchResult->*expr ).endExpression(); \ ( __catchResult+expr ).endExpression(); \
} \ } \
catch( ... ) { \ catch( ... ) { \
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \