From 5bc1c07c4a3724d55f82e32f13be6307de9adcff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Dumont?= Date: Thu, 16 Jul 2015 19:17:26 +0000 Subject: [PATCH] stl_algobase.h (__miter_base): Move... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2015-07-16 François Dumont * 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 | 7 +++ libstdc++-v3/include/bits/cpp_type_traits.h | 7 +++ libstdc++-v3/include/bits/stl_algobase.h | 6 --- libstdc++-v3/include/debug/functions.h | 3 +- .../23_containers/vector/debug/insert7_neg.cc | 44 +++++++++++++++++++ 5 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 59fbd1f6c39..3362427f997 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2015-07-16 François Dumont + + * 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 PR libstdc++/66855 diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index f7b76bf8b51..b66b61f2c65 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -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 + inline _Iterator + __miter_base(_Iterator __it) + { return __it; } + _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 703e91c34e0..75a15167e93 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -277,12 +277,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __niter_base(_Iterator __it) { return __it; } - // Likewise for move_iterator. - template - 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.) diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h index 7f0659f5b25..a9f234b0723 100644 --- a/libstdc++-v3/include/debug/functions.h +++ b/libstdc++-v3/include/debug/functions.h @@ -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. + +// { dg-options "-std=gnu++11" } +// { dg-do run { xfail *-*-* } } + +#include +#include +#include + +void +test01() +{ + __gnu_debug::vector> 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(); +} -- 2.30.2