[Bug c++/69784] Range-based for loop can't handle same variable name in range declaration and in range expression
oszi at inf dot u-szeged.hu
gcc-bugzilla@gcc.gnu.org
Fri Feb 12 12:47:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69784
--- Comment #2 from Csaba Osztrogonác <oszi at inf dot u-szeged.hu> ---
If we explicitly add the type of element, we get a different error:
main.cpp:10:18: error: ‘begin’ was not declared in this scope
for (int i : i)
^
main.cpp:10:18: note: suggested alternatives:
In file included from /usr/include/c++/5/string:51:0,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from main.cpp:1:
/usr/include/c++/5/bits/range_access.h:87:5: note: ‘std::begin’
begin(_Tp (&__arr)[_Nm])
^
/usr/include/c++/5/bits/range_access.h:87:5: note: ‘std::begin’
More information about the Gcc-bugs
mailing list