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.
This commit is contained in:
Andreas Kling 2019-08-24 21:45:32 +02:00
commit a00419ed77
Notes: sideshowbarker 2024-07-19 12:33:08 +09:00

View file

@ -121,6 +121,7 @@ public:
return fallback;
}
SET_TYPESTATE(consumed)
operator bool() const { return m_has_value; }
private: