From patchwork Thu Nov 11 20:02:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 47501 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31931385AC09 for ; Thu, 11 Nov 2021 20:02:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31931385AC09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636660976; bh=UjbkMJ1nsngKjiU/4sHbKdcirmVcSDupVhtigZuprHs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rB4rOF5aVLObHLJclAOsxTw9Kg00hiWX2PgxY4vaYRZeGa26tA8tA+5GF25zyi0S6 lYqMgyMOnNwqt+kUur09tB5hDulpB5NRq/0XJgZkA/EchizFpU9Ac3mTItIzSnsi/b M5mxy4wPzg2yeVgUBUFwPyabmOXB/SI1VmHJ9f2o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 86BDD385B804 for ; Thu, 11 Nov 2021 20:02:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86BDD385B804 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-N1ViX3UBM8Og5c9QpY5EqQ-1; Thu, 11 Nov 2021 15:02:25 -0500 X-MC-Unique: N1ViX3UBM8Og5c9QpY5EqQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBFFB8799E0; Thu, 11 Nov 2021 20:02:24 +0000 (UTC) Received: from localhost (unknown [10.33.36.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5ABFD177C0; Thu, 11 Nov 2021 20:02:24 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove public std::vector::data() member Date: Thu, 11 Nov 2021 20:02:23 +0000 Message-Id: <20211111200223.3062804-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux, pushed to trunk. This function only exists to avoid an error in the debug mode vector, so doesn't need to be public. libstdc++-v3/ChangeLog: * include/bits/stl_bvector.h (vector::data()): Give protected access, and delete for C++11 and later. --- libstdc++-v3/include/bits/stl_bvector.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 3778d5a770a..31d878427c2 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -996,14 +996,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER back() const { return *(end() - 1); } - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 464. Suggestion for new member functions in standard containers. - // N.B. DR 464 says nothing about vector but we need something - // here due to the way we are implementing DR 464 in the debug-mode - // vector class. - void - data() _GLIBCXX_NOEXCEPT { } - void push_back(bool __x) { @@ -1363,7 +1355,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator _M_erase(iterator __first, iterator __last); - }; + + protected: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + // N.B. DR 464 says nothing about vector but we need something + // here due to the using-declaration in __gnu_debug::vector. + // vector class. +#if __cplusplus >= 201103L + void data() = delete; +#else + void data() { } +#endif + }; _GLIBCXX_END_NAMESPACE_CONTAINER