https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54299
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-01-06 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Clang gives even better diagnostic now: <source>:7:17: error: cannot build range expression with array function parameter 'arr' since parameter with array type 'int[10]' is treated as pointer type 'int *' for (auto i : arr) ^~~ <source>:4:11: note: declared here int f(int arr[10]) ^ GCC trunk gives: <source>: In function 'int f(int*)': <source>:7:17: error: 'begin' was not declared in this scope 7 | for (auto i : arr) | ^~~ <source>:7:17: error: 'end' was not declared in this scope