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 authored and MarcoFalke committed 2020-11-24 09:46:49 +01:00
1 parent cb89e18845
commit fa861569dc
1 file changed
+1 -1
+1 -1
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