https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116369
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #9) > Ah no, during iterator construction we do: > > this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); > > So that is a library bug. Sorry I should have mentioned that line beforehand. After I noticed the mutable on one of the fields, I was more focused on that and the front-end side of things and getting a testcase there rather than describing the full sequence of code for the library side of things.