This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Internal compiler error 61


Nick Rasmussen <nick@jive.org> writes:
> 
> The following code causes an internal compiler error (61) with the current he
> ad of 
> the gcc-2.95 branch.
> 
> With the template removed from iterator, it gives the warning:
> foo.C:16: warning: lookup of `iterator' finds `struct iterator'
> foo.C:16: warning:   instead of `HashTable<T>::iterator' from dependent base 
> class
> foo.C:16: warning:   (use `typename HashTable::iterator' if that's what you m
> eant)
> 
> -nick
> 
> 
> template <class T>
> struct iterator {
> };
> 
> template <class T> 
> class map {
> public:
>   typedef int iterator;
>   static void erase(iterator __position);
> };
> 
> template<class T>
> class HashTable {
>   public:
>     typedef map<T> hash;
>     typedef hash::iterator iterator;
             ^^ typename
>     void            erase(iterator i) { hash::erase(i); return; }
> };
> 

Need the typename when typedefing iterator since it's dependent type.

Of course, ICE's are always bugs.

Regards,
Mumit


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]