mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03: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
Notes:
sideshowbarker
2024-07-18 11:05:45 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/3162c9e2144 Pull-request: https://github.com/SerenityOS/serenity/pull/8354 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/alimpfard
@ -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…
Reference in New Issue
Block a user