This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
C++ code works on gcc 4.4 but doesn't compile on 4.5.1
- From: Hugo Arregui <hugo dot arregui at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 3 Sep 2010 22:04:12 -0300
- Subject: C++ code works on gcc 4.4 but doesn't compile on 4.5.1
Hi guys,
as the subject says, I'm having a problem trying to compile the
attached code with gcc 4.5.1.
The error is:
test.cpp:16:46: error: prototype for 'typename
std::list<T>::const_iterator Test<T>::begin() const' does not match
any in class 'Test<T>'
test.cpp:11:31: error: candidate is: Test<T>::const_iterator
Test<T>::begin() const
make: *** [test] Error 1
I don't see any change related to this topic into the change logs.
Can you give me a point?
Thanks.
#include <list>
template<class T>
class Test
{
protected:
typedef std::list<T> ListAlias;
ListAlias list;
public:
typedef typename ListAlias::const_iterator const_iterator;
inline const_iterator begin() const;
};
template<class T>
inline typename std::list<T>::const_iterator Test<T>::begin() const
{
return list.begin();
};
int main()
{
return 0;
}