https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62169
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- The standard allows iterators of different containers to be different, your program is not portable of it assumes they will (or will not) be the same type. I don't consider this a bug, and am not very motivated to even document it, but will accept a documentation patch.