[libcxx-commits] [libcxx] [libc++] Enable modernize-use-equals-delete (PR #93293)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 17 04:24:46 PDT 2024


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/93293

>From bb2824a48429170a4f2f807eb9fa5510f6405822 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 23 May 2024 19:14:57 +0200
Subject: [PATCH] [libc++] Enable modernize-use-equals-delete

---
 libcxx/.clang-tidy                            |  2 +-
 libcxx/include/__bit_reference                |  3 +-
 libcxx/include/__functional/function.h        |  6 ++--
 .../include/__functional/reference_wrapper.h  |  2 +-
 .../locale_base_api/locale_guard.h            |  5 ++-
 libcxx/include/__mutex/lock_guard.h           |  1 -
 libcxx/include/__ostream/basic_ostream.h      |  6 ++--
 libcxx/include/__ranges/ref_view.h            |  2 +-
 libcxx/include/__thread/thread.h              |  5 ++-
 libcxx/include/__tree                         |  2 --
 libcxx/include/forward_list                   |  8 ++---
 libcxx/include/future                         |  5 ++-
 libcxx/include/iosfwd                         |  6 ++--
 libcxx/include/istream                        |  2 +-
 libcxx/include/list                           |  6 ++--
 libcxx/include/locale                         | 12 +++----
 libcxx/include/map                            | 14 ++++----
 libcxx/include/regex                          | 35 +++++++++----------
 libcxx/include/tuple                          |  4 +--
 libcxx/include/unordered_map                  |  8 ++---
 libcxx/include/vector                         |  2 +-
 21 files changed, 61 insertions(+), 75 deletions(-)

diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index d0b4cced9ffc3..f986e2100ca6b 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -17,6 +17,7 @@ Checks: >
   modernize-redundant-void-arg,
   modernize-use-nullptr,
   modernize-use-override,
+  modernize-use-equals-delete,
 
   readability-duplicate-include,
   readability-identifier-naming,
@@ -72,7 +73,6 @@ CheckOptions:
 # modernize-use-bool-literals,
 # modernize-use-default-member-init,
 # modernize-use-equals-default,
-# modernize-use-equals-delete,
 # portability-restrict-system-includes,
 # readability-function-cognitive-complexity,
 # readability-implicit-bool-conversion,
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 9579b9eaf70bb..391066da7d8e3 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -149,6 +149,7 @@ public:
   using __container = typename _Cp::__self;
 
   _LIBCPP_HIDE_FROM_ABI __bit_const_reference(const __bit_const_reference&) = default;
+  __bit_const_reference& operator=(const __bit_const_reference&) = delete;
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
       : __seg_(__x.__seg_),
@@ -167,8 +168,6 @@ private:
       __storage_pointer __s, __storage_type __m) _NOEXCEPT
       : __seg_(__s),
         __mask_(__m) {}
-
-  __bit_const_reference& operator=(const __bit_const_reference&) = delete;
 };
 
 // copy
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 244e55be3403c..fb82cfceadaff 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -232,10 +232,10 @@ class _LIBCPP_TEMPLATE_VIS __base;
 
 template <class _Rp, class... _ArgTypes>
 class __base<_Rp(_ArgTypes...)> {
-  __base(const __base&);
-  __base& operator=(const __base&);
-
 public:
+  __base(const __base&)            = delete;
+  __base& operator=(const __base&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI __base() {}
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
   virtual __base* __clone() const             = 0;
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index ab5d7c7cee115..3570e2673c800 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -39,7 +39,7 @@ class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> {
   type* __f_;
 
   static void __fun(_Tp&) _NOEXCEPT;
-  static void __fun(_Tp&&) = delete;
+  static void __fun(_Tp&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
 
 public:
   template <class _Up,
diff --git a/libcxx/include/__locale_dir/locale_base_api/locale_guard.h b/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
index b7e3be756e711..2baacb51cd065 100644
--- a/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
+++ b/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
@@ -30,9 +30,8 @@ struct __libcpp_locale_guard {
 
   locale_t __old_loc_;
 
-private:
-  __libcpp_locale_guard(__libcpp_locale_guard const&);
-  __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
+  __libcpp_locale_guard(__libcpp_locale_guard const&)            = delete;
+  __libcpp_locale_guard& operator=(__libcpp_locale_guard const&) = delete;
 };
 #elif defined(_LIBCPP_MSVCRT_LIKE)
 struct __libcpp_locale_guard {
diff --git a/libcxx/include/__mutex/lock_guard.h b/libcxx/include/__mutex/lock_guard.h
index 739d1683b317b..8340b9bbd4453 100644
--- a/libcxx/include/__mutex/lock_guard.h
+++ b/libcxx/include/__mutex/lock_guard.h
@@ -40,7 +40,6 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) loc
       : __m_(__m) {}
   _LIBCPP_HIDE_FROM_ABI ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); }
 
-private:
   lock_guard(lock_guard const&)            = delete;
   lock_guard& operator=(lock_guard const&) = delete;
 };
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index 697192bfb46b3..178359d681567 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -52,6 +52,9 @@ class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Tra
   }
   ~basic_ostream() override;
 
+  basic_ostream(const basic_ostream& __rhs)            = delete;
+  basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+
 protected:
   inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
 
@@ -62,9 +65,6 @@ class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Tra
     basic_ios<char_type, traits_type>::swap(__rhs);
   }
 
-  basic_ostream(const basic_ostream& __rhs)            = delete;
-  basic_ostream& operator=(const basic_ostream& __rhs) = delete;
-
 public:
   // 27.7.2.4 Prefix/suffix:
   class _LIBCPP_TEMPLATE_VIS sentry;
diff --git a/libcxx/include/__ranges/ref_view.h b/libcxx/include/__ranges/ref_view.h
index 6213332a542ab..5329d778dd30d 100644
--- a/libcxx/include/__ranges/ref_view.h
+++ b/libcxx/include/__ranges/ref_view.h
@@ -43,7 +43,7 @@ class ref_view : public view_interface<ref_view<_Range>> {
   _Range* __range_;
 
   static void __fun(_Range&);
-  static void __fun(_Range&&) = delete;
+  static void __fun(_Range&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
 
 public:
   template <class _Tp>
diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h
index 8db1e28ec7bf5..b68738cc41da0 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -69,14 +69,13 @@ class __thread_specific_ptr {
   __thread_specific_ptr();
   friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
 
-  __thread_specific_ptr(const __thread_specific_ptr&);
-  __thread_specific_ptr& operator=(const __thread_specific_ptr&);
-
   _LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
 
 public:
   typedef _Tp* pointer;
 
+  __thread_specific_ptr(const __thread_specific_ptr&)            = delete;
+  __thread_specific_ptr& operator=(const __thread_specific_ptr&) = delete;
   ~__thread_specific_ptr();
 
   _LIBCPP_HIDE_FROM_ABI pointer get() const { return static_cast<_Tp*>(__libcpp_tls_get(__key_)); }
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 5a0d8f42a69ce..78bafe069607d 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -651,7 +651,6 @@ public:
 
   _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
 
-private:
   ~__tree_node_base()                                  = delete;
   __tree_node_base(__tree_node_base const&)            = delete;
   __tree_node_base& operator=(__tree_node_base const&) = delete;
@@ -666,7 +665,6 @@ public:
 
   _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
 
-private:
   ~__tree_node()                             = delete;
   __tree_node(__tree_node const&)            = delete;
   __tree_node& operator=(__tree_node const&) = delete;
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 363931e3f2388..3ce2727315cee 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -510,19 +510,17 @@ protected:
       : __before_begin_(__begin_node(), __node_allocator(__a)) {}
   _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a)
       : __before_begin_(__begin_node(), __a) {}
-#ifndef _LIBCPP_CXX03_LANG
 
 public:
+#ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x)
       _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
   _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
 #endif // _LIBCPP_CXX03_LANG
 
-private:
-  __forward_list_base(const __forward_list_base&);
-  __forward_list_base& operator=(const __forward_list_base&);
+  __forward_list_base(const __forward_list_base&)            = delete;
+  __forward_list_base& operator=(const __forward_list_base&) = delete;
 
-public:
   _LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
 
 protected:
diff --git a/libcxx/include/future b/libcxx/include/future
index 7fa349eb8e84a..589f11a19f95f 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -1384,11 +1384,10 @@ class __packaged_task_base;
 
 template <class _Rp, class... _ArgTypes>
 class __packaged_task_base<_Rp(_ArgTypes...)> {
-  __packaged_task_base(const __packaged_task_base&);
-  __packaged_task_base& operator=(const __packaged_task_base&);
-
 public:
   _LIBCPP_HIDE_FROM_ABI __packaged_task_base() {}
+  __packaged_task_base(const __packaged_task_base&) = delete;
+  __packaged_task_base& operator=(const __packaged_task_base&) = delete;
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL
   virtual ~__packaged_task_base() {}
   virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 2481667dd972c..051c73995e98b 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -169,10 +169,10 @@ class __save_flags {
   fmtflags __fmtflags_;
   _CharT __fill_;
 
-  __save_flags(const __save_flags&);
-  __save_flags& operator=(const __save_flags&);
-
 public:
+    __save_flags(const __save_flags&) = delete;
+    __save_flags& operator=(const __save_flags&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
       : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
   _LIBCPP_HIDE_FROM_ABI ~__save_flags() {
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 21269c8a8b40f..d2b577a9ad9ef 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -216,10 +216,10 @@ protected:
     basic_ios<char_type, traits_type>::swap(__rhs);
   }
 
+public:
   basic_istream(const basic_istream& __rhs)            = delete;
   basic_istream& operator=(const basic_istream& __rhs) = delete;
 
-public:
   // 27.7.1.1.3 Prefix/suffix:
   class _LIBCPP_TEMPLATE_VIS sentry;
 
diff --git a/libcxx/include/list b/libcxx/include/list
index 87f15e144ac8f..e58876392312b 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -465,10 +465,10 @@ public:
 
 template <class _Tp, class _Alloc>
 class __list_imp {
-  __list_imp(const __list_imp&);
-  __list_imp& operator=(const __list_imp&);
-
 public:
+  __list_imp(const __list_imp&) = delete;
+  __list_imp& operator=(const __list_imp&) = delete;
+
   typedef _Alloc allocator_type;
   typedef allocator_traits<allocator_type> __alloc_traits;
   typedef typename __alloc_traits::size_type size_type;
diff --git a/libcxx/include/locale b/libcxx/include/locale
index c25861ff66987..69b391cf3a923 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -3148,9 +3148,6 @@ private:
   state_type __cvtstate_;
   size_t __cvtcount_;
 
-  wstring_convert(const wstring_convert& __wc);
-  wstring_convert& operator=(const wstring_convert& __wc);
-
 public:
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {}
@@ -3167,6 +3164,9 @@ public:
 #endif
   _LIBCPP_HIDE_FROM_ABI ~wstring_convert();
 
+  wstring_convert(const wstring_convert& __wc) = delete;
+  wstring_convert& operator=(const wstring_convert& __wc) = delete;
+
   _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
   _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
     return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
@@ -3371,9 +3371,6 @@ private:
   bool __owns_ib_;
   bool __always_noconv_;
 
-  wbuffer_convert(const wbuffer_convert&);
-  wbuffer_convert& operator=(const wbuffer_convert&);
-
 public:
 #ifndef _LIBCPP_CXX03_LANG
   _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
@@ -3393,6 +3390,9 @@ public:
     return __r;
   }
 
+  wbuffer_convert(const wbuffer_convert&)            = delete;
+  wbuffer_convert& operator=(const wbuffer_convert&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
 
 protected:
diff --git a/libcxx/include/map b/libcxx/include/map
index 7efa715e84aa7..b23f5b74b269d 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -715,8 +715,6 @@ public:
 private:
   allocator_type& __na_;
 
-  __map_node_destructor& operator=(const __map_node_destructor&);
-
 public:
   bool __first_constructed;
   bool __second_constructed;
@@ -735,6 +733,8 @@ public:
   }
 #endif // _LIBCPP_CXX03_LANG
 
+  __map_node_destructor& operator=(const __map_node_destructor&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
     if (__second_constructed)
       __alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
@@ -808,7 +808,6 @@ public:
     return *this;
   }
 
-private:
   __value_type()                    = delete;
   ~__value_type()                   = delete;
   __value_type(const __value_type&) = delete;
@@ -830,11 +829,10 @@ public:
   _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
   _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
 
-private:
-  __value_type();
-  __value_type(__value_type const&);
-  __value_type& operator=(__value_type const&);
-  ~__value_type();
+  __value_type()                               = delete;
+  __value_type(__value_type const&)            = delete;
+  __value_type& operator=(__value_type const&) = delete;
+  ~__value_type()                              = delete;
 };
 
 #endif // _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 46968357d3974..751ebcf78d507 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1345,13 +1345,12 @@ struct __state {
 
 template <class _CharT>
 class __node {
-  __node(const __node&);
-  __node& operator=(const __node&);
-
 public:
   typedef std::__state<_CharT> __state;
 
   _LIBCPP_HIDE_FROM_ABI __node() {}
+  __node(const __node&)            = delete;
+  __node& operator=(const __node&) = delete;
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL
   virtual ~__node() {}
 
@@ -1952,14 +1951,14 @@ class __match_char : public __owns_one_state<_CharT> {
 
   _CharT __c_;
 
-  __match_char(const __match_char&);
-  __match_char& operator=(const __match_char&);
-
 public:
   typedef std::__state<_CharT> __state;
 
   _LIBCPP_HIDE_FROM_ABI __match_char(_CharT __c, __node<_CharT>* __s) : base(__s), __c_(__c) {}
 
+  __match_char(const __match_char&) = delete;
+  __match_char& operator=(const __match_char&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
 };
 
@@ -1984,15 +1983,15 @@ class __match_char_icase : public __owns_one_state<_CharT> {
   _Traits __traits_;
   _CharT __c_;
 
-  __match_char_icase(const __match_char_icase&);
-  __match_char_icase& operator=(const __match_char_icase&);
-
 public:
   typedef std::__state<_CharT> __state;
 
   _LIBCPP_HIDE_FROM_ABI __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
       : base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
 
+  __match_char_icase(const __match_char_icase&) = delete;
+  __match_char_icase& operator=(const __match_char_icase&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
 };
 
@@ -2017,15 +2016,15 @@ class __match_char_collate : public __owns_one_state<_CharT> {
   _Traits __traits_;
   _CharT __c_;
 
-  __match_char_collate(const __match_char_collate&);
-  __match_char_collate& operator=(const __match_char_collate&);
-
 public:
   typedef std::__state<_CharT> __state;
 
   _LIBCPP_HIDE_FROM_ABI __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
       : base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
 
+  __match_char_collate(const __match_char_collate&)            = delete;
+  __match_char_collate& operator=(const __match_char_collate&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
 };
 
@@ -2061,9 +2060,6 @@ class __bracket_expression : public __owns_one_state<_CharT> {
   bool __collate_;
   bool __might_have_digraph_;
 
-  __bracket_expression(const __bracket_expression&);
-  __bracket_expression& operator=(const __bracket_expression&);
-
 public:
   typedef std::__state<_CharT> __state;
 
@@ -2078,6 +2074,9 @@ public:
         __collate_(__collate),
         __might_have_digraph_(__traits_.getloc().name() != "C") {}
 
+  __bracket_expression(const __bracket_expression&)            = delete;
+  __bracket_expression& operator=(const __bracket_expression&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
 
   _LIBCPP_HIDE_FROM_ABI bool __negated() const { return __negate_; }
@@ -2699,9 +2698,6 @@ class __lookahead : public __owns_one_state<_CharT> {
   unsigned __mexp_;
   bool __invert_;
 
-  __lookahead(const __lookahead&);
-  __lookahead& operator=(const __lookahead&);
-
 public:
   typedef std::__state<_CharT> __state;
 
@@ -2709,6 +2705,9 @@ public:
   __lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
       : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
 
+  __lookahead(const __lookahead&) = delete;
+  __lookahead& operator=(const __lookahead&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
 };
 
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e614e37cfaec6..6d8ef2f24e0fb 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -304,9 +304,9 @@ class __tuple_leaf {
 #  endif
   }
 
+public:
   _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
 
-public:
   _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {
     static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
   }
@@ -380,9 +380,9 @@ public:
 
 template <size_t _Ip, class _Hp>
 class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
+public:
   _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
 
-public:
   _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
 
   template <class _Alloc>
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 2e25b0f050695..4e861c75b465f 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -792,12 +792,12 @@ public:
 private:
   allocator_type& __na_;
 
-  __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
-
 public:
   bool __first_constructed;
   bool __second_constructed;
 
+  __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
+
   _LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
       : __na_(__na),
         __first_constructed(false),
@@ -882,7 +882,6 @@ public:
     return *this;
   }
 
-private:
   __hash_value_type(const __hash_value_type& __v) = delete;
   __hash_value_type(__hash_value_type&& __v)      = delete;
   template <class... _Args>
@@ -906,8 +905,7 @@ public:
   _LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
   _LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
 
-private:
-  ~__hash_value_type();
+  ~__hash_value_type() = delete;
 };
 
 #endif
diff --git a/libcxx/include/vector b/libcxx/include/vector
index fb03f77dbe767..e4c33582a2adf 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -905,6 +905,7 @@ private:
       __v_.__annotate_increase(__n);
 #endif
     }
+
     _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
       __v_.__end_ = __pos_;
 #ifndef _LIBCPP_HAS_NO_ASAN
@@ -918,7 +919,6 @@ private:
     pointer __pos_;
     const_pointer const __new_end_;
 
-  private:
     _ConstructTransaction(_ConstructTransaction const&)            = delete;
     _ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
   };



More information about the libcxx-commits mailing list