Obviously the following code of the definition of class destructor is wrong, but it passed g++ 4.4.2 in Fedora 12. However g++ 4.1.2 and g++ 3.4.6 in Fedora 12 reported the error.
The testing code is list below: #include <iostream> template <typename T> class Base { public: Base(); ~Base(); }; template <typename T> Base<T>::Base() { std::cout << "Base()" << std::endl; } template <typename T> Base<T>::~BaseTypo() { std::cout << "~BaseTypo()" << std::endl; } int main() { Base<int>* pObj = new Base<int> (); delete pObj; return 0; } -- Summary: Invalid Destructor Name of A Template Class Is Accepted Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: shreks2099 at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42514