[Bug libstdc++/57010] [c++0x] priority_queue<>::pop() calls self-move-assignment operator

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Sat Apr 20 10:16:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57010

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-04-20
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
     Ever Confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-20 10:15:59 UTC ---
Mine. I'm testing something like this:

Index: stl_heap.h
===================================================================
--- stl_heap.h    (revision 198008)
+++ stl_heap.h    (working copy)
@@ -291,8 +291,11 @@
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_heap(__first, __last);

-      --__last;
-      std::__pop_heap(__first, __last, __last);
+      if (__last - __first > 1)
+    {
+      --__last;
+      std::__pop_heap(__first, __last, __last);
+    }
     }

   template<typename _RandomAccessIterator, typename _Distance,
@@ -363,8 +366,11 @@
       __glibcxx_requires_non_empty_range(__first, __last);
       __glibcxx_requires_heap_pred(__first, __last, __comp);

-      --__last;
-      std::__pop_heap(__first, __last, __last, __comp);
+      if (__last - __first > 1)
+    {
+      --__last;
+      std::__pop_heap(__first, __last, __last, __comp);
+    }
     }

   /**



More information about the Gcc-bugs mailing list