public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-5179] libstdc++: Remove public std::vector<bool>::data() member
Date: Thu, 11 Nov 2021 20:02:10 +0000 (GMT)	[thread overview]
Message-ID: <20211111200210.6109C3858037@sourceware.org> (raw)

https://gcc.gnu.org/g:ef0e100f5870bbb792f378858864f915696dd232

commit r12-5179-gef0e100f5870bbb792f378858864f915696dd232
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 11 13:02:16 2021 +0000

    libstdc++: Remove public std::vector<bool>::data() member
    
    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<bool>::data()): Give
            protected access, and delete for C++11 and later.

Diff:
---
 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<bool> 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<bool> 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


                 reply	other threads:[~2021-11-11 20:02 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=20211111200210.6109C3858037@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.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).