(re)Inlined isTrue()

This commit is contained in:
Phil Nash 2017-11-21 13:12:22 +00:00
parent e54dcdac8b
commit 3b965aa501
3 changed files with 2 additions and 3 deletions

View File

@ -63,7 +63,7 @@
CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
} INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
INTERNAL_CATCH_REACT( catchAssertionHandler ) \
} while( Catch::isTrue( false && static_cast<bool>( !!(__VA_ARGS__) ) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
} while( Catch::isTrue(false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
///////////////////////////////////////////////////////////////////////////////

View File

@ -38,7 +38,6 @@ namespace Catch {
return os;
}
bool isTrue( bool value ){ return value; }
bool alwaysTrue() { return true; }
bool alwaysFalse() { return false; }

View File

@ -61,7 +61,7 @@ namespace Catch {
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
// This is just here to avoid compiler warnings with macro constants and boolean literals
bool isTrue( bool value );
inline bool isTrue( bool value ){ return value; }
bool alwaysTrue();
bool alwaysFalse();