mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
AK: Make (Nonnull)OwnPtr
work with abstract classes
Clang produced a compile error at this requires statement if `T` was an abstract class.
This commit is contained in:
parent
b97a00d4b1
commit
3162c9e214
2 changed files with 2 additions and 3 deletions
|
@ -33,7 +33,7 @@ public:
|
|||
: m_ptr(&ptr)
|
||||
{
|
||||
static_assert(
|
||||
requires { requires typename T::AllowOwnPtr()(); } || !requires(T obj) { requires !typename T::AllowOwnPtr()(); obj.ref(); obj.unref(); },
|
||||
requires { requires typename T::AllowOwnPtr()(); } || !requires { requires !typename T::AllowOwnPtr()(); declval<T>().ref(); declval<T>().unref(); },
|
||||
"Use NonnullRefPtr<> for RefCounted types");
|
||||
}
|
||||
NonnullOwnPtr(NonnullOwnPtr&& other)
|
||||
|
|
|
@ -184,8 +184,7 @@ protected:
|
|||
: m_ptr(ptr)
|
||||
{
|
||||
static_assert(
|
||||
requires { requires typename T::AllowOwnPtr()(); } || !requires(T obj) { requires !typename T::AllowOwnPtr()(); obj.ref(); obj.unref(); },
|
||||
"Use RefPtr<> for RefCounted types");
|
||||
requires { requires typename T::AllowOwnPtr()(); } || !requires { requires !typename T::AllowOwnPtr()(); declval<T>().ref(); declval<T>().unref(); }, "Use RefPtr<> for RefCounted types");
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue