typedef confuses the name of the template and the name of result: sh-3.2$ cat tloop_iterator.h #ifndef TLOOP_ITERATOR_H_ #define TLOOP_ITERATOR_H_
#include <list> template<typename T> struct loop_iterator : public T::iterator { }; template <typename T> struct list : std::list<T> { typedef loop_iterator<list> loop_iterator; }; #endif Compiling this file: sh-3.2$ g++-4.1 tloop_iterator.h sh-3.2$ g++-4.2 tloop_iterator.h all right, but: sh-3.2$ g++-4.3 tloop_iterator.h tloop_iterator.h:14: error: declaration of typedef struct loop_iterator<list<T> > list<T>::loop_iterator tloop_iterator.h:8: error: changes meaning of loop_iterator from struct loop_iterator<list<T> > sh-3.2$ g++-4.3 --version g++-4.3 (Debian 4.3.2-1) 4.3.2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. My system is Debian GLU/Linux Lenny Version 4.3.1 also has this problem -- Summary: typedef confuses the name of the template and the name of result Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: resume755 at mail dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38501