Bug 10916 - parse error when trying to create iterator with a template
Summary: parse error when trying to create iterator with a template
Status: CLOSED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.2
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-21 20:23 UTC by blake madden
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description blake madden 2003-05-21 20:23:35 UTC
When you try to create an iterator (in this case a vector) to a templatized 
container you will get a parse error, although I have no problem with creating 
a templatized container itself.  const_iterator has the same problem. The 
following demonstrates:

class<typename Tchar_type = char>
class Object
   {
   std::vector<Tchar_type> m_charvector; //this works
   std::vector<Tchar_type>::iterator m_iter; //this gives a parse error, but...
   std::vector<char>::iterator m_iter2; //this is OK
   };
Comment 1 Wolfgang Bangerth 2003-05-21 20:50:08 UTC
You have to use "typename" if you want to refer to nested typenames of
template classes.

W.
Comment 2 blake madden 2003-06-16 19:28:33 UTC
User error...