mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:07:34 +00:00
Kernel: Delete the rvalue-ref qualified version of KResultOr::value()
This makes calling value() on a temporary KResultOr be a compile-time error. This exposed a number of missing error checks (fixed in the preceding commits.)
This commit is contained in:
parent
d065de1fcf
commit
74ce098d58
1 changed files with 4 additions and 2 deletions
|
@ -138,18 +138,20 @@ public:
|
|||
|
||||
[[nodiscard]] KResult result() const { return m_is_error ? m_error : KSuccess; }
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE T& value()
|
||||
[[nodiscard]] ALWAYS_INLINE T& value() &
|
||||
{
|
||||
VERIFY(!m_is_error);
|
||||
return *reinterpret_cast<T*>(&m_storage);
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE const T& value() const
|
||||
[[nodiscard]] ALWAYS_INLINE T const& value() const&
|
||||
{
|
||||
VERIFY(!m_is_error);
|
||||
return *reinterpret_cast<T*>(&m_storage);
|
||||
}
|
||||
|
||||
T value() && = delete;
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE T release_value()
|
||||
{
|
||||
VERIFY(!m_is_error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue