mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Explicitly convert the assert condition using bool()
This allows a shared pointer as a condition because bool(std::shared_ptr<T>) is defined.
This commit is contained in:
parent
51a98ab84a
commit
00e8b059ea
@ -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.");
|
/// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong.");
|
||||||
/// Do NOT supply an exception object as the second parameter.
|
/// Do NOT supply an exception object as the second parameter.
|
||||||
#define assertThrow(_condition, _ExceptionType, _description) \
|
#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>;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user