diff mbox series

PR libstdc++/86954 use non-placement operator delete

Message ID 20180814201913.GA11888@redhat.com
State New
Headers show
Series PR libstdc++/86954 use non-placement operator delete | expand

Commit Message

Jonathan Wakely Aug. 14, 2018, 8:19 p.m. UTC
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.

Tested x86_64-linux, committed to trunk.
commit dc7ca8956ad18f583feeb55e011e1333f65fd6da
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 14 20:52:44 2018 +0100

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

Patch

diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h
index 159ee27a5d3..0abd3c12de7 100644
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -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); }
 
 
   /**