public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUG
Date: Fri, 26 Aug 2022 15:47:45 +0000 (GMT)	[thread overview]
Message-ID: <20220826154745.6DE4538515D6@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=834113203876a0815fdea45b98b7f52c743f4c0e

commit 834113203876a0815fdea45b98b7f52c743f4c0e
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Aug 26 11:46:01 2022 -0400

    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

Diff:
---
 gdbsupport/gdb_optional.h | 4 ++--
 1 file 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;

                 reply	other threads:[~2022-08-26 15:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220826154745.6DE4538515D6@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).