// // Tests for // explicit operator bool() const; // #include #include #include "test_utils.h" #include struct T { int i; }; template static void tests() { { test_safe_allocation const array(10, libkern::allocate_memory); CHECK(static_cast(array)); if (array) { } else { CHECK(FALSE); } } { test_safe_allocation const array = nullptr; CHECK(!static_cast(array)); if (!array) { } else { CHECK(FALSE); } } static_assert(!std::is_convertible_v, bool>); } T_DECL(operator_bool, "safe_allocation.operator.bool", T_META_TAG_VM_PREFERRED) { tests(); tests(); }