[Bug c++/38501] New: typedef confuses the name of the template and the name of result

resume755 at mail dot ru gcc-bugzilla@gcc.gnu.org
Fri Dec 12 01:42:00 GMT 2008


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



More information about the Gcc-bugs mailing list