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]

typedef, class template and inheritance




	egcs-970929 failed to compile the code below:

% cat toto.C

template <class T, class U> struct foo {
    typedef U fred_t;

    fred_t foobar() {}
};

template <class T> struct bar : public foo<T, T> {

    fred_t foobar();
};

template <class T> bar<T>::fred_t bar<T>::foobar() { return fred_t(); }


% g++ -c toto.C
toto.C:13: new declaration `T bar<T>::foobar()'
toto.C:10: ambiguates old declaration `typename foo<T,T>::fred_t bar<T>::foobar()'



Adding

	typedef foo<T, T>::fred_t fred_t;

to the class definition of bar get think fine. gcc shouldn't flag the
former code not legal. Should it ?

-- Gaby



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