PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators
commit866cd688d1b72b0700a7e001428bdf2fe73fbf64
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Jul 2018 20:49:10 +0000 (24 20:49 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Jul 2018 20:49:10 +0000 (24 20:49 +0000)
tree75e812b20a7595ed400dd6b2dd7a1a87a4a76037
parent495105e3c623b59bc52a536d2fa29763e0286803
PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators

An output iterator passed as the unused first argument to __niter_wrap
might have already been invalidated, so don't copy it.

PR libstdc++/86658
* include/bits/stl_algobase.h (__niter_wrap<_Iterator>): Pass unused
parameter by reference, to avoid copying invalid iterators.
* testsuite/25_algorithms/copy/86658.cc: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262952 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/testsuite/25_algorithms/copy/86658.cc [new file with mode: 0644]