[libcxx] Qualify make_move_iterator in vector::insert for input iterators
authorLouis Dionne <ldionne@apple.com>
Tue, 11 Feb 2020 09:59:12 +0000 (10:59 +0100)
committerLouis Dionne <ldionne@apple.com>
Tue, 11 Feb 2020 10:00:45 +0000 (11:00 +0100)
Unqualified calls to make_move_iterator in the vector::insert overload
for input iterators lead to ADL issues: https://gcc.godbolt.org/z/bmcNbh

Patch by Logan Smith.

Differential Revision: https://reviews.llvm.org/D74290

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

index 8366bb5..af96bff 100644 (file)
@@ -1956,8 +1956,8 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
 #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;
 }
 
index 74cb612..413030d 100644 (file)
 #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 @@ int main(int, char**)
     }
 #endif
 
+    {
+        std::vector<adl::S> s;
+        s.insert(s.end(), input_iterator<adl::S*>(), input_iterator<adl::S*>());
+    }
+
   return 0;
 }