https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105470
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- GCC even tells you exactly how to fix the code. Here's the GCC error reformatted to make it a bit easier to read: error: loop variable it of type const std::pair<Scintilla::Internal::KeyModifiers, Scintilla::Message>& binds to a temporary constructed from type const std::pair<const Scintilla::Internal::KeyModifiers, Scintilla::Message> [-Werror=range-loop-construct] note: use non-reference type const std::pair<Scintilla::Internal::KeyModifiers, Scintilla::Message> to make the copy explicit or const std::pair<const Scintilla::Internal::KeyModifiers, Scintilla::Message>& to prevent copying cc1plus: all warnings being treated as errors