[libcxx-commits] [libcxx] 0a20660 - [libcxx] Resolve LWG 2724 protected -> private.
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 23 14:27:31 PST 2020
Author: zoecarver
Date: 2020-11-23T14:27:22-08:00
New Revision: 0a20660c8fcb5bb8469e323585eeaecacea67c44
URL: https://github.com/llvm/llvm-project/commit/0a20660c8fcb5bb8469e323585eeaecacea67c44
DIFF: https://github.com/llvm/llvm-project/commit/0a20660c8fcb5bb8469e323585eeaecacea67c44.diff
LOG: [libcxx] Resolve LWG 2724 protected -> private.
Fixes LWG issue 2724: "The protected virtual member functions of memory_resource should be private."
Differential Revision: https://reviews.llvm.org/D66615
Added:
libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
Modified:
libcxx/include/experimental/memory_resource
Removed:
libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
################################################################################
diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource
index f999fb9befda..816d21f51368 100644
--- a/libcxx/include/experimental/memory_resource
+++ b/libcxx/include/experimental/memory_resource
@@ -116,7 +116,7 @@ public:
{ return do_is_equal(__other); }
// 8.5.3, memory.resource.priv
-protected:
+private:
virtual void* do_allocate(size_t, size_t) = 0;
virtual void do_deallocate(void*, size_t, size_t) = 0;
virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0;
@@ -381,7 +381,7 @@ public:
{ return __alloc_; }
// 8.7.3, memory.resource.adaptor.mem
-protected:
+private:
virtual void * do_allocate(size_t __bytes, size_t)
{
if (__bytes > __max_size()) {
@@ -407,7 +407,6 @@ protected:
return __p ? __alloc_ == __p->__alloc_ : false;
}
-private:
_LIBCPP_INLINE_VISIBILITY
size_t __max_size() const _NOEXCEPT {
return numeric_limits<size_t>::max() - _MaxAlign;
diff --git a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
similarity index 73%
rename from libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
rename to libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
index 85c4ce4ee91c..a0c84b0fa83c 100644
--- a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
+++ b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
@@ -10,9 +10,9 @@
// <experimental/memory_resource>
-// memory_resource::do_allocate(size_t, size_t); /* protected */
-// memory_resource::do_deallocate(void*, size_t, size_t); /* protected */
-// memory_resource::do_is_equal(memory_resource const&); /* protected */
+// memory_resource::do_allocate(size_t, size_t); /* private */
+// memory_resource::do_deallocate(void*, size_t, size_t); /* private */
+// memory_resource::do_is_equal(memory_resource const&); /* private */
#include <experimental/memory_resource>
@@ -20,9 +20,9 @@ namespace ex = std::experimental::pmr;
int main(int, char**) {
ex::memory_resource *m = ex::new_delete_resource();
- m->do_allocate(0, 0); // expected-error{{'do_allocate' is a protected member}}
- m->do_deallocate(nullptr, 0, 0); // expected-error{{'do_deallocate' is a protected member}}
- m->do_is_equal(*m); // expected-error{{'do_is_equal' is a protected member}}
+ m->do_allocate(0, 0); // expected-error{{'do_allocate' is a private member}}
+ m->do_deallocate(nullptr, 0, 0); // expected-error{{'do_deallocate' is a private member}}
+ m->do_is_equal(*m); // expected-error{{'do_is_equal' is a private member}}
return 0;
}
More information about the libcxx-commits
mailing list