This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49834] [C++0x] type deduction in for-each loop in template function
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 2 Aug 2011 14:53:58 +0000
- Subject: [Bug c++/49834] [C++0x] type deduction in for-each loop in template function
- Auto-submitted: auto-generated
- References: <bug-49834-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49834
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Summary|type deduction in for-each |[C++0x] type deduction in
|loop in template function |for-each loop in template
| |function
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-02 14:53:52 UTC ---
The failure can be fixed by adding the 'template' keyword:
for (const auto &i: p)// ERROR
i.second.template get_value<int>();
^^^^^^^^^
Jason, is G++ correct to require that there?
If so, should it also require it on the previous loop?
for (const C::value_type &i: p)// OK
i.second.template get_value<int>();
^^^^^^^^^
i.e. is the real bug that we accept the first loop, not that we reject the
second?