[libcxx-commits] [libcxx] 2b0ec7c - [libc++] Fix a use-after-move introduced in D118003.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 8 18:59:28 PST 2022


Author: Arthur O'Dwyer
Date: 2022-03-08T21:57:40-05:00
New Revision: 2b0ec7ca44ea227665f25b7dc3a3c097f16673cb

URL: https://github.com/llvm/llvm-project/commit/2b0ec7ca44ea227665f25b7dc3a3c097f16673cb
DIFF: https://github.com/llvm/llvm-project/commit/2b0ec7ca44ea227665f25b7dc3a3c097f16673cb.diff

LOG: [libc++] Fix a use-after-move introduced in D118003.

Thanks to Eric Fiselier for catching this!

Added: 
    

Modified: 
    libcxx/include/__algorithm/sift_down.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h
index 6a6646d0442dc..0351a1c578b01 100644
--- a/libcxx/include/__algorithm/sift_down.h
+++ b/libcxx/include/__algorithm/sift_down.h
@@ -98,7 +98,7 @@ __floyd_sift_down(_RandomAccessIterator __first, _Compare __comp,
 
         // swap __hole with its largest child
         *__hole = std::move(*__child_i);
-        __hole = std::move(__child_i);
+        __hole = __child_i;
 
         // if __hole is now a leaf, we're done
         if (__child > (__len - 2) / 2)


        


More information about the libcxx-commits mailing list