summaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-08-26 11:46:01 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-08-26 11:47:23 -0400
commit834113203876a0815fdea45b98b7f52c743f4c0e (patch)
treea2ec1c5061f0d4d38ee45a7646ff841223d52108 /gdbsupport
parent403c71fdace8e0f16807470ec1c3dc505bcb78d4 (diff)
downloadbinutils-gdb-834113203876a0815fdea45b98b7f52c743f4c0e.tar.gz
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
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/gdb_optional.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdbsupport/gdb_optional.h b/gdbsupport/gdb_optional.h
index 70b15bd3bdc..1ea6164ec73 100644
--- a/gdbsupport/gdb_optional.h
+++ b/gdbsupport/gdb_optional.h
@@ -202,14 +202,14 @@ private:
/* 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;