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]
Other format: [Raw text]

[Bug preprocessor/15947] New: Puzzling error message for wrong destructor declaration in template class


First reported in http://gcc.gnu.org/ml/gcc/2004-06/msg00690.html:

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

What should be reported instead is that the correct syntax for a destructor is
Test<Type>::~Test(void) , i.e., omit the extra <Test>

-- 
           Summary: Puzzling error message for wrong destructor declaration
                    in template class
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: giovannibajo at libero dot it
        ReportedBy: pkoning at equallogic dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-netbsdelf1.6.2
  GCC host triplet: i386-unknown-netbsdelf1.6.2
GCC target triplet: i386-unknown-netbsdelf1.6.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15947


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