stl_algobase.h (__miter_base): Move...
authorFrançois Dumont <fdumont@gcc.gnu.org>
Thu, 16 Jul 2015 19:17:26 +0000 (19:17 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Thu, 16 Jul 2015 19:17:26 +0000 (19:17 +0000)
2015-07-16  François Dumont  <fdumont@gcc.gnu.org>

* include/bits/stl_algobase.h (__miter_base): Move...
* include/bits/cpp_type_traits.h: ...here.
* include/debug/functions.h (__foreign_iterator_aux): Use latter.
* testsuite/23_containers/vector/debug/insert7_neg.cc: New.

From-SVN: r225902

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/cpp_type_traits.h
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/debug/functions.h
libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc [new file with mode: 0644]

index 59fbd1f6c394530b738315bbe467fc2bb4facad1..3362427f99746c64f3fe9ae9e9f188f15e39c96d 100644 (file)
@@ -1,3 +1,10 @@
+2015-07-16  François Dumont  <fdumont@gcc.gnu.org>
+
+       * include/bits/stl_algobase.h (__miter_base): Move...
+       * include/bits/cpp_type_traits.h: ...here.
+       * include/debug/functions.h (__foreign_iterator_aux): Use latter.
+       * testsuite/23_containers/vector/debug/insert7_neg.cc: New.
+
 2015-07-13  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/66855
index f7b76bf8b5134cd17a2631b73f8e9641c86fd8af..b66b61f2c65dff57a78949f481a92c3d258f7459 100644 (file)
@@ -399,6 +399,13 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
       typedef __false_type __type;
     };
 
+  // Fallback implementation of the function in bits/stl_iterator.h used to
+  // remove the move_iterator wrapper.
+  template<typename _Iterator>
+    inline _Iterator
+    __miter_base(_Iterator __it)
+    { return __it; }
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
index 703e91c34e006d789fe9bc1a4f4ed071bae38fd8..75a15167e937fb25cc234b6c60bd43365992e7cd 100644 (file)
@@ -277,12 +277,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __niter_base(_Iterator __it)
     { return __it; }
 
-  // Likewise for move_iterator.
-  template<typename _Iterator>
-    inline _Iterator
-    __miter_base(_Iterator __it)
-    { return __it; }
-
   // All of these auxiliary structs serve two purposes.  (1) Replace
   // calls to copy with memmove whenever possible.  (Memmove, not memcpy,
   // because the input and output ranges are permitted to overlap.)
index 7f0659f5b256d9c6c427dd1e4478fc356acff6b6..a9f234b0723513e801d1eb58c3feeed92492acb7 100644 (file)
@@ -198,7 +198,8 @@ namespace __gnu_debug
                           std::__false_type)
     {
       return _Insert_range_from_self_is_safe<_Sequence>::__value
-            || __foreign_iterator_aux2(__it, __other, __other_end);
+       || __foreign_iterator_aux2(__it, std::__miter_base(__other),
+                                  std::__miter_base(__other_end));
     }
 
   template<typename _Iterator, typename _Sequence,
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc
new file mode 100644 (file)
index 0000000..eef427f
--- /dev/null
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do run { xfail *-*-* } }
+
+#include <memory>
+#include <iterator>
+#include <debug/vector>
+
+void
+test01()
+{
+  __gnu_debug::vector<std::unique_ptr<int>> v;
+
+  v.emplace_back(new int(0));
+  v.emplace_back(new int(1));
+
+  v.insert(begin(v) + 1,
+          make_move_iterator(begin(v)),
+          make_move_iterator(end(v)));
+}
+
+int
+main()
+{
+  test01();
+}