[libcxx-commits] [libcxx] b7eb30d - __bit_reference: fix -Wdeprecated-copy warnings

Fangrui Song via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 12 16:31:43 PST 2019


Author: Fangrui Song
Date: 2019-12-12T16:31:36-08:00
New Revision: b7eb30d48131c0b42cf5fa5bf866e846959876c2

URL: https://github.com/llvm/llvm-project/commit/b7eb30d48131c0b42cf5fa5bf866e846959876c2
DIFF: https://github.com/llvm/llvm-project/commit/b7eb30d48131c0b42cf5fa5bf866e846959876c2.diff

LOG: __bit_reference: fix -Wdeprecated-copy warnings

Since C++11, [depr.impldec]:

The implicit definition of a copy constructor as defaulted is deprecated
if the class has a user-declared copy assignment operator or a
user-declared destructor.

At clang HEAD, -Wdeprecated-copy (included by -Wextra) will warn on such instances.

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D71096

Added: 
    

Modified: 
    libcxx/include/__bit_reference

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 05dfbe7e9fff..bbc159834242 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -47,6 +47,9 @@ class __bit_reference
     friend class __bit_const_reference<_Cp>;
     friend class __bit_iterator<_Cp, false>;
 public:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_reference(const __bit_reference&) = default;
+
     _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
         {return static_cast<bool>(*__seg_ & __mask_);}
     _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
@@ -132,6 +135,9 @@ class __bit_const_reference
     friend typename _Cp::__self;
     friend class __bit_iterator<_Cp, true>;
 public:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_const_reference(const __bit_const_reference&) = default;
+
     _LIBCPP_INLINE_VISIBILITY
     __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
         : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
@@ -147,7 +153,7 @@ private:
     __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
         : __seg_(__s), __mask_(__m) {}
 
-    __bit_const_reference& operator=(const __bit_const_reference& __x);
+    __bit_const_reference& operator=(const __bit_const_reference&) = delete;
 };
 
 // find


        


More information about the libcxx-commits mailing list