https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103583
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The error is technically correct. If your class had both begin and end, then the range-based for loop would use a.begin() and a.end(). But because it doesn't have both, the loop uses begin(a) and end(a), neither of which is defined. And that's what the error says.