mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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
Notes:
sideshowbarker
2024-07-18 04:47:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/74ce098d580
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…
Reference in a new issue