This is the mail archive of the gcc@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]

Problem with nested template class


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


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