https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103583
Bug ID: 103583 Summary: Range loop: "error: 'begin' was not declared in this scope" when 'end' is missing Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: shlomo at fastmail dot com Target Milestone: --- Compiling the following with gcc -c: struct A { int *begin(); // int *end(); }; void foo(A a) { for (auto it : a) { } } shows two error messages: error: ‘begin’ was not declared in this scope error: ‘end’ was not declared in this scope The first error message is incorrect. If only one of 'begin' and 'end' is missing, GCC shouldn't print an error about the other one.