diff --git a/ctl/unique_ptr.h b/ctl/unique_ptr.h index 8ae17ed27..179beda12 100644 --- a/ctl/unique_ptr.h +++ b/ctl/unique_ptr.h @@ -71,7 +71,7 @@ struct unique_ptr inline void reset(nullptr_t = nullptr) noexcept { - if (*this) + if (p) d(p); p = nullptr; } @@ -81,7 +81,7 @@ struct unique_ptr /* requires is_convertible_v */ inline void reset(U* p2) { - if (*this) { + if (p) { d(p); } p = static_cast(p2); @@ -117,14 +117,14 @@ struct unique_ptr inline element_type& operator*() const noexcept(noexcept(*std::declval())) { - if (!*this) + if (!p) __builtin_trap(); return *p; } inline pointer operator->() const noexcept { - if (!*this) + if (!p) __builtin_trap(); return p; }