From fa861569dcfff9e72686dc5f30b1faa645b4d54e Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sun, 11 Oct 2020 21:04:50 +0200 Subject: 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; ^ --- src/util/check.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/check.h b/src/util/check.h index 9edf394492..aca0c3d9f9 100644 --- a/src/util/check.h +++ b/src/util/check.h @@ -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(check); }() +#define Assert(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward(check); }()) #endif // BITCOIN_UTIL_CHECK_H -- cgit v1.2.3