Skip to content

Commit fa86156

Browse files
practicalswiftMarcoFalke
authored andcommitted
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; ^
1 parent cb89e18 commit fa86156

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/check.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ T get_pure_r_value(T&& val)
5454
}
5555

5656
/** Identity function. Abort if the value compares equal to zero */
57-
#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); }()
57+
#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); }())
5858

5959
#endif // BITCOIN_UTIL_CHECK_H

0 commit comments

Comments
 (0)