//File template_test.cpp
# include <iostream>
# include <vector>


class V
{
public:
template <class T>
  static void RPG(const std::vector<T>& listIn, std::vector<T>& listOut);
} ;

template <class T>
inline
void V::RPG(const std::vector<T>& listIn, 
                                                         std::vector<T>&
listOut)
{
        for(std::vector<T>::const_iterator iter = listIn.begin();       iter !=
listIn.end(); iter++)
        {
                //do nothing
        }
}


When compiling this the parser errors out with the below message

*******************************************************
g++ -c template_test.cpp
template_test.cpp: In static member function `static void V::RPG(const
std::vector<T, std::allocator<_CharT> >&, std::vector<T, std::allocator<_CharT>
>&)':
template_test.cpp:17: error: expected `;' before "iter"
template_test.cpp:17: error: `iter' undeclared (first use this function)
template_test.cpp:17: error: (Each undeclared identifier is reported only once
for each function it appears in.)
*************************************************************

Any help here ?

Thank you,
Ravi


-- 
           Summary: parser error when passing the template arg to STL
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raviprakashg at hotmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32740

Reply via email to