mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUG
Similar to 911438f9f4
("gdbsupport: fix array-view compilation with
c++11 && _GLIBCXX_DEBUG"), but for gdb::optional.
I get this error when building with Clang 14 and -std=c++11:
CXX agent.o
In file included from /home/simark/src/binutils-gdb/gdbsupport/agent.cc:20:
In file included from /home/simark/src/binutils-gdb/gdbsupport/common-defs.h:210:
In file included from /home/simark/src/binutils-gdb/gdbsupport/common-debug.h:23:
/home/simark/src/binutils-gdb/gdbsupport/../gdbsupport/gdb_optional.h:213:5: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
gdb_assert (this->has_value ());
^
/home/simark/src/binutils-gdb/gdbsupport/gdb_assert.h:35:3: note: expanded from macro 'gdb_assert'
((void) ((expr) ? 0 : \
^
Change-Id: If0cf55607fc9dbd1925ccb97cd9abbf8993ff264
This commit is contained in:
parent
403c71fdac
commit
8341132038
@ -202,14 +202,14 @@ class optional
|
||||
/* The get operations have m_instantiated as a precondition. */
|
||||
T &get () noexcept
|
||||
{
|
||||
#if defined(_GLIBCXX_DEBUG)
|
||||
#if defined(_GLIBCXX_DEBUG) && __cplusplus >= 201402L
|
||||
gdb_assert (this->has_value ());
|
||||
#endif
|
||||
return m_item;
|
||||
}
|
||||
constexpr const T &get () const noexcept
|
||||
{
|
||||
#if defined(_GLIBCXX_DEBUG)
|
||||
#if defined(_GLIBCXX_DEBUG) && __cplusplus >= 201402L
|
||||
gdb_assert (this->has_value ());
|
||||
#endif
|
||||
return m_item;
|
||||
|
Loading…
Reference in New Issue
Block a user