https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95578
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-06-09 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 CC| |ppalka at gcc dot gnu.org --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- Confirmed. When writing the normal/reverse/move iterator optimizations for the ranges algos, I wrongly assumed that if the begin() of a range is a normal_iterator (or reverse_iterator, or move_iterator) then the end() must be, too. But as this testcase shows, it's perfectly valid to have a range whose begin() is a normal_iterator but its end() is not. So these optimizations should check that the iterator and sentinel have the same type before proceeding.