This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69784] Range-based for loop can't handle same variable name in range declaration and in range expression


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â

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]