OwnPtr now always deletes the owned object directly from clear(). Remove the unused deleter template parameter and the DefaultDelete helper that only supported that parameter. Drop the dedicated custom deleter test.
21 lines
439 B
C++
21 lines
439 B
C++
/*
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibTest/TestCase.h>
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
TEST_CASE(destroy_self_owning_object)
|
|
{
|
|
struct SelfOwning {
|
|
OwnPtr<SelfOwning> self;
|
|
};
|
|
OwnPtr<SelfOwning> object = make<SelfOwning>();
|
|
auto* object_ptr = object.ptr();
|
|
object->self = move(object);
|
|
object = nullptr;
|
|
object_ptr->self = nullptr;
|
|
}
|