From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oBuiOEPrCGNZqC0AWB0awg (envelope-from ) for ; Fri, 26 Aug 2022 11:48:19 -0400 Received: by simark.ca (Postfix, from userid 112) id E5B6A1E4A7; Fri, 26 Aug 2022 11:48:19 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=IttJ2Mqo; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A56201E222 for ; Fri, 26 Aug 2022 11:48:19 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 190CD38515CE for ; Fri, 26 Aug 2022 15:48:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 190CD38515CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661528899; bh=mqWH51g7yvUZDMZW7qRJgxPv1W1/GQbVb9CN2HaZPCg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IttJ2Mqoutir9g+UeKZmOLj2MQq17tnWkx7GaL2tHNYuF/fmYxTC8YExemCLyT7ki CJOkl4s9osvwdr4MJY1PgfkdtJluu46dkPPowKXhQTtT74rNCJ8D0JhyEQTXLnXWm2 kKDKfQHu85S8/R8dCid24TvKs2LivQkXXKmwUg9g= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 68EDC3857416 for ; Fri, 26 Aug 2022 15:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 68EDC3857416 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 27QFlrai005665 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Aug 2022 11:47:58 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 27QFlrai005665 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9E6111E222; Fri, 26 Aug 2022 11:47:53 -0400 (EDT) To: gdb-patches@sourceware.org Subject: [pushed] gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUG Date: Fri, 26 Aug 2022 11:47:53 -0400 Message-Id: <20220826154753.2170793-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 26 Aug 2022 15:47:53 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 --- 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 70b15bd3bdc2..1ea6164ec731 100644 --- a/gdbsupport/gdb_optional.h +++ b/gdbsupport/gdb_optional.h @@ -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; base-commit: 403c71fdace8e0f16807470ec1c3dc505bcb78d4 -- 2.37.2