[Bug c++/58407] [C++11] Should warn about deprecated implicit generation of copy constructor/assignment

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 13 12:18:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58407

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks! I can take care of the rest of the library, but for now this makes all
the deque tests pass:


--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -149,9 +149,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       _Deque_iterator() _GLIBCXX_NOEXCEPT
       : _M_cur(), _M_first(), _M_last(), _M_node() { }

+#if __cplusplus < 201103L
+      // Conversion from iterator to const_iterator.
       _Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
       : _M_cur(__x._M_cur), _M_first(__x._M_first),
        _M_last(__x._M_last), _M_node(__x._M_node) { }
+#else
+      // Conversion from iterator to const_iterator.
+      template<typename _Iter,
+              typename = _Require<is_same<_Self, const_iterator>,
+                                  is_same<_Iter, iterator>>>
+       _Deque_iterator(const _Iter& __x) noexcept
+       : _M_cur(__x._M_cur), _M_first(__x._M_first),
+         _M_last(__x._M_last), _M_node(__x._M_node) { }
+
+      _Deque_iterator(const _Deque_iterator&) = default;
+      _Deque_iterator& operator=(const _Deque_iterator&) = default;
+#endif

       iterator
       _M_const_cast() const _GLIBCXX_NOEXCEPT
diff --git a/libstdc++-v3/include/ext/throw_allocator.h
b/libstdc++-v3/include/ext/throw_allocator.h
index 5d9caa2bcae..f773a2d79ba 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -403,6 +403,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   struct condition_base
   {
     virtual ~condition_base() { };
+#if __cplusplus >= 201103L
+    condition_base() = default;
+    condition_base(const condition_base&) = default;
+    condition_base& operator=(const condition_base&) = default;
+#endif
   };


More information about the Gcc-bugs mailing list