From a00419ed7730065d2eee0713a51009c651832d8a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 24 Aug 2019 21:45:32 +0200 Subject: [PATCH] AK: Optional::operator bool() should consume the Optional We use consumable annotations to catch bugs where you get the .value() of an Optional before verifying that it's okay. The bug here was that only has_value() would set the consumed state, even though operator bool() does the same job. --- AK/Optional.h | 1 + 1 file changed, 1 insertion(+) diff --git a/AK/Optional.h b/AK/Optional.h index 589cc9b646..1fff294e81 100644 --- a/AK/Optional.h +++ b/AK/Optional.h @@ -121,6 +121,7 @@ public: return fallback; } + SET_TYPESTATE(consumed) operator bool() const { return m_has_value; } private: