diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-09-07 23:39:49 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-09-10 01:11:15 +0800 |
commit | 00e8b059ea0ecd4a945657eabed17293dc73024a (patch) | |
tree | ce9ff6ebbd75a55dbd887c83eaa1a198a4ecceba | |
parent | 51a98ab84a59fd5fb34378763fd9ed635cf06d8d (diff) | |
download | dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar.gz dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar.bz2 dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar.lz dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar.xz dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.tar.zst dexon-solidity-00e8b059ea0ecd4a945657eabed17293dc73024a.zip |
Explicitly convert the assert condition using bool()
This allows a shared pointer as a condition because bool(std::shared_ptr<T>) is defined.
-rw-r--r-- | libdevcore/Assertions.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/libdevcore/Assertions.h b/libdevcore/Assertions.h index 7b4a4a76..05e0b0e5 100644 --- a/libdevcore/Assertions.h +++ b/libdevcore/Assertions.h @@ -73,7 +73,7 @@ inline bool assertEqualAux(A const& _a, B const& _b, char const* _aStr, char con /// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong."); /// Do NOT supply an exception object as the second parameter. #define assertThrow(_condition, _ExceptionType, _description) \ - ::dev::assertThrowAux<_ExceptionType>(_condition, _description, __LINE__, __FILE__, ETH_FUNC) + ::dev::assertThrowAux<_ExceptionType>(!!(_condition), _description, __LINE__, __FILE__, ETH_FUNC) using errinfo_comment = boost::error_info<struct tag_comment, std::string>; @@ -96,16 +96,4 @@ inline void assertThrowAux( ); } -template <class _ExceptionType> -inline void assertThrowAux( - void const* _pointer, - ::std::string const& _errorDescription, - unsigned _line, - char const* _file, - char const* _function -) -{ - assertThrowAux<_ExceptionType>(_pointer != nullptr, _errorDescription, _line, _file, _function); -} - } |