[Bug c++/105470] ranged for loop whitespace parsing

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 4 00:21:47 GMT 2022


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


More information about the Gcc-bugs mailing list