https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99402
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced: #include <algorithm> #include <set> #include <vector> using namespace std; int main() { // any container with non-random access iterators: const set<int> source = { 0, 1 }; vector<int> dest(1); copy(source.begin(), ++source.begin(), dest.begin()); }