use sizeof(expr) for unevaluated syntax check

This commit is contained in:
Mickey Rose
2017-01-19 15:04:54 +01:00
committed by Martin Hořeňovský
parent cfaf906417
commit 227598af47
2 changed files with 3 additions and 5 deletions

View File

@@ -40,8 +40,7 @@
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
} \
INTERNAL_CATCH_REACT( __catchResult ) \
} while( Catch::isTrue( false && static_cast<bool>( !!(expr) ) ) ) // expr 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 &&.
} while( Catch::alwaysFalse( sizeof(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \