PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators
authorJonathan Wakely <jwakely@redhat.com>
Tue, 24 Jul 2018 20:49:10 +0000 (21:49 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 24 Jul 2018 20:49:10 +0000 (21:49 +0100)
commite874029dd994ce1dd098a143aa06a0894da7b7de
tree75e812b20a7595ed400dd6b2dd7a1a87a4a76037
parented623edb473d862673fc0bbc6b878074667ca5fb
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.

From-SVN: r262952
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/testsuite/25_algorithms/copy/86658.cc [new file with mode: 0644]