File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ namespace BCLog {
41
41
42
42
BOOST_FIXTURE_TEST_SUITE (util_tests, BasicTestingSetup)
43
43
44
+ BOOST_AUTO_TEST_CASE(util_check)
45
+ {
46
+ // Check that Assert can forward
47
+ const std::unique_ptr<int > p_two = Assert (MakeUnique<int >(2 ));
48
+ // Check that Assert works on lvalues and rvalues
49
+ const int two = *Assert (p_two);
50
+ Assert (two == 2 );
51
+ Assert (true );
52
+ }
53
+
44
54
BOOST_AUTO_TEST_CASE (util_criticalsection)
45
55
{
46
56
RecursiveMutex cs;
Original file line number Diff line number Diff line change @@ -54,6 +54,6 @@ T get_pure_r_value(T&& val)
54
54
}
55
55
56
56
/* * 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 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) ; }()
58
58
59
59
#endif // BITCOIN_UTIL_CHECK_H
You can’t perform that action at this time.
0 commit comments