Bug 1954030 - TestRefPtr.cpp: fix a [-Werror=self-move] warning r=gsvelto DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D241601
This commit is contained in:
Sylvestre Ledru
2025-03-19 08:35:25 +00:00
parent 312d7d03ba
commit 750015f69f

View File

@@ -109,7 +109,9 @@ int main() {
} }
MOZ_RELEASE_ASSERT(10 == Foo::sNumDestroyed); MOZ_RELEASE_ASSERT(10 == Foo::sNumDestroyed);
{ RefPtr<Foo> f1 = new Bar(); } {
RefPtr<Foo> f1 = new Bar();
}
MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed); MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed);
{ {
@@ -121,7 +123,9 @@ int main() {
{ {
RefPtr<Foo> f = new Foo(); RefPtr<Foo> f = new Foo();
f = std::move(static_cast<RefPtr<Foo>&>(f));
auto& alias = f;
f = std::move(static_cast<RefPtr<Foo>&>(alias));
MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed); MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed);
} }
MOZ_RELEASE_ASSERT(12 == Foo::sNumDestroyed); MOZ_RELEASE_ASSERT(12 == Foo::sNumDestroyed);