mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Prevent confusing silent misuse of Userspace<T>
This commit is contained in:
parent
a6314f2ce6
commit
b4f26c2b31
Notes:
sideshowbarker
2024-07-19 03:18:00 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/b4f26c2b311 Pull-request: https://github.com/SerenityOS/serenity/pull/3262
1 changed files with 8 additions and 1 deletions
|
@ -48,6 +48,13 @@ public:
|
|||
operator bool() const { return m_ptr; }
|
||||
operator FlatPtr() const { return (FlatPtr)m_ptr; }
|
||||
|
||||
// Disable default implementations that would use surprising integer promotion.
|
||||
bool operator==(const Userspace&) const = delete;
|
||||
bool operator<=(const Userspace&) const = delete;
|
||||
bool operator>=(const Userspace&) const = delete;
|
||||
bool operator<(const Userspace&) const = delete;
|
||||
bool operator>(const Userspace&) const = delete;
|
||||
|
||||
#ifdef KERNEL
|
||||
Userspace(FlatPtr ptr)
|
||||
: m_ptr(ptr)
|
||||
|
@ -86,5 +93,5 @@ inline Userspace<T> static_ptr_cast(const Userspace<U>& ptr)
|
|||
|
||||
}
|
||||
|
||||
using AK::Userspace;
|
||||
using AK::static_ptr_cast;
|
||||
using AK::Userspace;
|
||||
|
|
Loading…
Reference in a new issue