AK: Make NonnullRefPtr::operator=(NonnullRefPtr<U>&&) cast incoming pointer.

Same as the RefPtr issue I just fixed. This makes it possible to assign a
NonnullRefPtr<Derived>&& to a NonnullRefPtr<Base>.
This commit is contained in:
Andreas Kling 2019-07-21 11:44:31 +02:00
parent dea7f937bf
commit 20c6edc976
Notes: sideshowbarker 2024-07-19 13:06:24 +09:00

View file

@ -136,7 +136,7 @@ public:
{
if (this != static_cast<void*>(&other)) {
deref_if_not_null(m_ptr);
m_ptr = &other.leak_ref();
m_ptr = static_cast<T*>(&other.leak_ref());
}
return *this;
}