This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem with nested template class
- To: gcc at gcc dot gnu dot org
- Subject: Problem with nested template class
- From: George Garvey <tmwg-gcc at inxservices dot com>
- Date: Sat, 30 Jun 2001 06:40:41 -0700
- Organization: inX Services, Los Angeles, CA, USA
Given this:
template <class T> class Tree {
public:
template <T> class Traverser {
public:
Traverser(const Tree<T> &tree);
};
};
template <class T> inline
Tree<T>::Traverser<T>::Traverser(const Tree<T> &tree) {
;
}
gcc 3 says this:
t.cc:10: type/value mismatch at argument 1 in template parameter list for
`template<T> template<T <anonymous> > class Tree<T>::Traverser'
t.cc:10: expected a constant of type `T', got `T'
t.cc:10: confused by earlier errors, bailing out
Is there a way to do this that works? I don't understand the error message.
If I change the inner declaration to
template <class T> class Traverser {
I just get a different problem:
t.cc:3: declaration of `class T'
t.cc:1: shadows template parm `class T'
t.cc:10: parse error before `const'
t.cc:10: `T' was not declared in this scope
t.cc:10: template argument 1 is invalid
t.cc:10: syntax error before `)' token