diff options
Diffstat (limited to 'absl/types/optional.h')
-rw-r--r-- | absl/types/optional.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/absl/types/optional.h b/absl/types/optional.h index 1670022dde4e..142dc83a2039 100644 --- a/absl/types/optional.h +++ b/absl/types/optional.h @@ -421,7 +421,9 @@ class optional : private optional_internal::optional_data<T>, // // Accesses the underlying `T` value of an `optional`. If the `optional` is // empty, behavior is undefined. - constexpr const T& operator*() const & { return reference(); } + constexpr const T& operator*() const& { + return ABSL_ASSERT(this->engaged_), reference(); + } T& operator*() & { assert(this->engaged_); return reference(); |