// // Tests for // explicit constexpr operator bool() const noexcept; // #include #include #include #include "test_policy.h" struct T { int i; }; template static void tests() { T obj{3}; { test_shared_ptr const ptr(&obj, libkern::no_retain); CHECK(static_cast(ptr)); if (ptr) { } else { CHECK(false); } } { test_shared_ptr const ptr = nullptr; CHECK(!static_cast(ptr)); if (!ptr) { } else { CHECK(false); } } static_assert(!std::is_convertible_v, bool>); } T_DECL(operator_bool, "intrusive_shared_ptr.operator.bool", T_META_TAG_VM_PREFERRED) { tests(); tests(); }