This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/69784] Range-based for loop can't handle same variable name in range declaration and in range expression
- From: "oszi at inf dot u-szeged.hu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Feb 2016 12:47:47 +0000
- Subject: [Bug c++/69784] Range-based for loop can't handle same variable name in range declaration and in range expression
- Auto-submitted: auto-generated
- References: <bug-69784-4 at http dot gcc dot gnu dot org/bugzilla/>
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â