0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

util: Allow Assert(...) to be used in all contexts

Fixes the compile error when used inside operator[]:

./chain.h:404:23: error: C++11 only allows consecutive left square brackets when introducing an attribute
        return (*this)[Assert(pindex)->nHeight] == pindex;
                      ^
This commit is contained in:
practicalswift 2020-10-11 21:04:50 +02:00 committed by MarcoFalke
parent cb89e18845
commit fa861569dc
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -54,6 +54,6 @@ T get_pure_r_value(T&& val)
}
/** Identity function. Abort if the value compares equal to zero */
#define Assert(val) [&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }()
#define Assert(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }())
#endif // BITCOIN_UTIL_CHECK_H