[libcxx-commits] [PATCH] D74290: [libcxx] Qualify make_move_iterator in vector::insert for input iterators

Logan Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 8 13:54:04 PST 2020


logan-5 created this revision.
logan-5 added reviewers: EricWF, mclow.lists.
logan-5 added a project: libc++.
Herald added subscribers: libcxx-commits, ldionne, christof.

Unqualified calls to make_move_iterator in the vector::insert overload for input iterators lead to ADL issues: https://gcc.godbolt.org/z/bmcNbh

As a bookkeeping question, are these ADL fixes more useful as tiny separate patches like this, or would it be less annoying if they were bundled together in a larger patch?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74290

Files:
  libcxx/include/vector
  libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp


Index: libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -21,6 +21,11 @@
 #include "min_allocator.h"
 #include "asan_testing.h"
 
+namespace adl {
+struct S {};
+void make_move_iterator(S*) {}
+}
+
 int main(int, char**)
 {
     {
@@ -172,5 +177,10 @@
     }
 #endif
 
+    {
+        std::vector<adl::S> s;
+        s.insert(s.end(), input_iterator<adl::S*>(), input_iterator<adl::S*>());
+    }
+
   return 0;
 }
Index: libcxx/include/vector
===================================================================
--- libcxx/include/vector
+++ libcxx/include/vector
@@ -1956,8 +1956,8 @@
 #endif  // _LIBCPP_NO_EXCEPTIONS
     }
     __p = _VSTD::rotate(__p, __old_last, this->__end_);
-    insert(__make_iter(__p), make_move_iterator(__v.begin()),
-                                    make_move_iterator(__v.end()));
+    insert(__make_iter(__p), _VSTD::make_move_iterator(__v.begin()),
+                             _VSTD::make_move_iterator(__v.end()));
     return begin() + __off;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74290.243408.patch
Type: text/x-patch
Size: 1294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200208/12ae89bb/attachment.bin>


More information about the libcxx-commits mailing list