]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/backward/auto_ptr.h
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / backward / auto_ptr.h
index d7ae4877abea1542c0eada1863ecb8d2f13578ab..85116364cd23b8bddc2b322fad92811da07f5ae4 100644 (file)
@@ -1,6 +1,6 @@
 // auto_ptr implementation -*- C++ -*-
 
-// Copyright (C) 2007-2014 Free Software Foundation, Inc.
+// Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -53,6 +53,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
     } _GLIBCXX_DEPRECATED;
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
   /**
    *  @brief  A simple smart pointer providing strict ownership semantics.
@@ -180,7 +182,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       element_type&
       operator*() const throw() 
       {
-       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+       __glibcxx_assert(_M_ptr != 0);
        return *_M_ptr; 
       }
       
@@ -193,7 +195,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       element_type*
       operator->() const throw() 
       {
-       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+       __glibcxx_assert(_M_ptr != 0);
        return _M_ptr; 
       }
       
@@ -249,13 +251,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       /** 
        *  @brief  Automatic conversions
        *
-       *  These operations convert an %auto_ptr into and from an auto_ptr_ref
-       *  automatically as needed.  This allows constructs such as
+       *  These operations are supposed to convert an %auto_ptr into and from
+       *  an auto_ptr_ref automatically as needed.  This would allow
+       *  constructs such as
        *  @code
        *    auto_ptr<Derived>  func_returning_auto_ptr(.....);
        *    ...
        *    auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
        *  @endcode
+       *
+       *  But it doesn't work, and won't be fixed. For further details see
+       *  http://cplusplus.github.io/LWG/lwg-closed.html#463
        */
       auto_ptr(auto_ptr_ref<element_type> __ref) throw()
       : _M_ptr(__ref._M_ptr) { }
@@ -298,7 +304,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { __r.release(); }
 
   template<typename _Tp, _Lock_policy _Lp>
-  template<typename _Tp1>
+  template<typename _Tp1, typename>
     inline
     __shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r)
     : _M_ptr(__r.get()), _M_refcount()
@@ -307,11 +313,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       static_assert( sizeof(_Tp1) > 0, "incomplete type" );
       _Tp1* __tmp = __r.get();
       _M_refcount = __shared_count<_Lp>(std::move(__r));
-      __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+      _M_enable_shared_from_this_with(__tmp);
     }
 
   template<typename _Tp>
-  template<typename _Tp1>
+  template<typename _Tp1, typename>
     inline
     shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r)
     : __shared_ptr<_Tp>(std::move(__r)) { }
@@ -323,6 +329,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     : _M_t(__u.release(), deleter_type()) { }
 #endif
 
+#pragma GCC diagnostic pop
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace