Puzzling error message about templates (gcc 3.4.0)

Paul Koning pkoning@equallogic.com
Thu Jun 10 19:07:00 GMT 2004


GCC 3.4 objects to this (GCC 3.3 does not):

template <class Type> class Test
{
public:
	Test(void);
	~Test(void);
	static bool probe(void *addr);
};

template <class Type> inline bool Test<Type>::probe(void *addr)
{}

template <class Type> inline Test<Type>::Test<Type>(void)
{}

template <class Type> inline Test<Type>::~Test<Type>(void)
{}

The error messages is:

foo.cc:15: error: non-template `Test' used as template
foo.cc:15: error: (use `Test<Type>::template Test' to indicate that it is a template)
foo.cc:15: error: expected class-name at end of input
foo.cc:15: error: expected init-declarator at end of input
foo.cc:15: error: expected `;' at end of input

I can't figure out what the suggestion is trying to suggest (in other
words, I can't tell what the proposed replacement source would look
like).

But what's really puzzling is that it only complains about the
destructor, even though the other two methods have the identical
pattern.  Parser bug?

	  paul



More information about the Gcc mailing list