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
This commit is contained in:
Phil Nash 2015-06-26 06:35:33 +01:00
parent c51e86819d
commit 8cc1108f2b
3 changed files with 7 additions and 5 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

@ -688,6 +688,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = ( WARNING_CFLAGS = (
"-Weverything", "-Weverything",
"-Wparentheses",
"-Wno-disabled-macro-expansion", "-Wno-disabled-macro-expansion",
); );
}; };
@ -705,6 +706,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
WARNING_CFLAGS = ( WARNING_CFLAGS = (
"-Weverything", "-Weverything",
"-Wparentheses",
"-Wno-disabled-macro-expansion", "-Wno-disabled-macro-expansion",
); );
}; };