diff options
Diffstat (limited to 'gdbsupport/gdb_optional.h')
-rw-r--r-- | gdbsupport/gdb_optional.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gdbsupport/gdb_optional.h b/gdbsupport/gdb_optional.h index e79ba2c..745b2ba 100644 --- a/gdbsupport/gdb_optional.h +++ b/gdbsupport/gdb_optional.h @@ -200,8 +200,20 @@ private: } /* The get operations have m_instantiated as a precondition. */ - T &get () noexcept { return m_item; } - constexpr const T &get () const noexcept { return m_item; } + T &get () noexcept + { +#if defined(_GLIBCXX_DEBUG) + gdb_assert (this->has_value ()); +#endif + return m_item; + } + constexpr const T &get () const noexcept + { +#if defined(_GLIBCXX_DEBUG) + gdb_assert (this->has_value ()); +#endif + return m_item; + } /* The object. */ union |