https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86658
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Tue Jul 24 20:49:10 2018 New Revision: 262952 URL: https://gcc.gnu.org/viewcvs?rev=262952&root=gcc&view=rev Log: 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. Added: trunk/libstdc++-v3/testsuite/25_algorithms/copy/86658.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_algobase.h
