https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Also, set keys are *not* const, otherwise you wouldn't be able to assign one set to another set without reallocating every element. std::set<T>::iterator only gives you const *access* to the elements, but the elements themselves are not actually const.