[libcxx-commits] [PATCH] D71096: __bit_reference: fix -Wdeprecated-copy warnings

Fangrui Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 5 16:05:06 PST 2019


MaskRay created this revision.
MaskRay added reviewers: EricWF, ldionne, mclow.lists.
Herald added subscribers: libcxx-commits, dexonsmith, christof.
Herald added a project: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71096

Files:
  libcxx/include/__bit_reference


Index: libcxx/include/__bit_reference
===================================================================
--- libcxx/include/__bit_reference
+++ libcxx/include/__bit_reference
@@ -47,6 +47,10 @@
     friend class __bit_const_reference<_Cp>;
     friend class __bit_iterator<_Cp, false>;
 public:
+    _LIBCPP_INLINE_VISIBILITY
+    __bit_reference(const __bit_reference& __x) _NOEXCEPT : __seg_(__x.__seg_),
+                                                            __mask_(__x.__mask_) {}
+
     _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
         {return static_cast<bool>(*__seg_ & __mask_);}
     _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
@@ -146,8 +150,6 @@
     _LIBCPP_CONSTEXPR
     __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
         : __seg_(__s), __mask_(__m) {}
-
-    __bit_const_reference& operator=(const __bit_const_reference& __x);
 };
 
 // find


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71096.232464.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191206/56f9735c/attachment.bin>


More information about the libcxx-commits mailing list