PR libstdc++/86954 use non-placement operator delete
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Aug 2018 20:19:20 +0000 (21:19 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 14 Aug 2018 20:19:20 +0000 (21:19 +0100)
As explained in the PR, there's no reason to call the nothrow delete,
we can just use the normal one.

PR libstdc++/86954
* include/bits/stl_tempbuf.h (return_temporary_buffer): Use
non-placement delete.

From-SVN: r263542

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_tempbuf.h

index cf69f2160723a7738ee6a041c4278b30a324caf4..182c0ed2ff39ec5857b42acb00e23a9d6cd2a74c 100644 (file)
@@ -1,5 +1,9 @@
 2018-08-14  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/86954
+       * include/bits/stl_tempbuf.h (return_temporary_buffer): Use
+       non-placement delete.
+
        * include/std/chrono (__check_overflow): Simplify definition.
        (_Checked_integral_constant): Remove.
 
index 159ee27a5d39e818151dc9c57bea87b988a884e9..0abd3c12de768ba1b3cc95d77b8895fa93bd93f1 100644 (file)
@@ -88,10 +88,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        __gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp);
       if (__len > __max)
        __len = __max;
-      
-      while (__len > 0) 
+
+      while (__len > 0)
        {
-         _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), 
+         _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp),
                                                        std::nothrow));
          if (__tmp != 0)
            return std::pair<_Tp*, ptrdiff_t>(__tmp, __len);
@@ -110,7 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     inline void
     return_temporary_buffer(_Tp* __p)
-    { ::operator delete(__p, std::nothrow); }
+    { ::operator delete(__p); }
 
 
   /**