File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ BOOST_AUTO_TEST_CASE(util_check)
76
76
const int two = *Assert (p_two);
77
77
Assert (two == 2 );
78
78
Assert (true );
79
+ // Check that Assume can be used as unary expression
80
+ const bool result{Assume (two == 2 )};
81
+ Assert (result);
79
82
}
80
83
81
84
BOOST_AUTO_TEST_CASE (util_criticalsection)
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ T get_pure_r_value(T&& val)
69
69
#ifdef ABORT_ON_FAILED_ASSUME
70
70
#define Assume (val ) Assert(val)
71
71
#else
72
- #define Assume (val ) (( void )( val))
72
+ #define Assume (val ) ([&]() -> decltype (get_pure_r_value( val)) { auto && check = (val); return std::forward< decltype ( get_pure_r_value (val))>(check); }( ))
73
73
#endif
74
74
75
75
#endif // BITCOIN_UTIL_CHECK_H
You can’t perform that action at this time.
0 commit comments