C++ code works on gcc 4.4 but doesn't compile on 4.5.1

Sam Varshavchik mrsam@courier-mta.com
Sat Sep 4 01:55:00 GMT 2010


Hugo Arregui writes:

> 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?

Try changing your definition to:

template<class T>
inline typename Test<T>::const_iterator Test<T>::begin() const
{
    return list.begin();
};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20100904/5b529905/attachment.sig>


More information about the Gcc-help mailing list