This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15505] New: pure virtual destructor not overloaded, but accepted
- From: "b dot perschbacher at att dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 May 2004 22:21:19 -0000
- Subject: [Bug c++/15505] New: pure virtual destructor not overloaded, but accepted
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When declaring a pure virtual destructor in a base class the complier will allow
a sub class to be created without having to define an implementation of a
destructor. However, linker errors are thrown when the references to the
destructors can't be found. This should not make it to the linker but instead be
caught like all other missing implementations of pure virtuals.
the command g++ -v returned:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
I am using redhat 9.0 with the kernal listed above (I guess, this machine is
maitained by my company) with dual xeon processors.
some code to reproduce this bug:
#include <iostream>
using namespace std;
class base {
public:
base(void){
cout << "Base default constructor." << endl << flush;
}
virtual ~base(void) = 0;
};
class base2 {
public:
base2(void){
cout << "Base2 default constructor." << endl << flush;
}
virtual ~base2(void){};
};
class sub : public base {
public:
sub(void){
cout << "Sub default constructor." << endl << flush;
}
};
class sub2 : public base, public base2 {
public:
sub(void){
cout << "Sub default constructor." << endl << flush;
}
};
int main(void){
sub subby;
sub2 subby2;
return 0;
}
//------------------------------------------------------------------------------
note the fact that it seems to be looking for the base destructors in subclasses
constructors.
--
Summary: pure virtual destructor not overloaded, but accepted
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: b dot perschbacher at att dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15505