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:
Andreas Kling 2021-09-04 12:55:37 +02:00
parent d065de1fcf
commit 74ce098d58
Notes: sideshowbarker 2024-07-18 04:47:44 +09:00

View file

@ -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);