http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54299
--- Comment #2 from Jonathan Wakely 2012-08-17
15:43:02 UTC ---
It would be nice if G++ told you the type of the range, as Clang++ does:
a.cc:9:15: error: use of undeclared identifier 'begin'
for (auto i : arr)
^
a.cc:9:15: note:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54299
--- Comment #1 from Jonathan Wakely 2012-08-17
15:40:42 UTC ---
I think the compiler's correct to reject the first example, the type of arr is
int* so it's not an array, and so the for loop calls begin(arr) and end(arr)
In the second example the