LibGC: Add missing & in Weak assignment

The Weak<T>::operator=(U const&) template incorrectly compares the
internal pointer directly against the `other` reference. If this
template is instantiated, it causes a compilation error because a Ptr<T>
cannot be compared directly to a U const&
This commit is contained in:
Davi Gomes 2026-03-14 19:38:07 -03:00 committed by Andreas Kling
parent f146294b23
commit d7c90639ae

View file

@ -49,7 +49,7 @@ template<typename U>
Weak<T>& Weak<T>::operator=(U const& other)
requires(IsConvertible<U*, T*>)
{
if (ptr() != other) {
if (ptr() != &other) {
m_impl = *other.heap().create_weak_impl(const_cast<void*>(static_cast<void const*>(&other)));
}
return *this;