public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15505] New: pure virtual destructor not overloaded, but accepted
@ 2004-05-18 15:32 b dot perschbacher at att dot net
  2004-05-18 15:33 ` [Bug c++/15505] " b dot perschbacher at att dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: b dot perschbacher at att dot net @ 2004-05-18 15:32 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-05-20 11:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-18 15:32 [Bug c++/15505] New: pure virtual destructor not overloaded, but accepted b dot perschbacher at att dot net
2004-05-18 15:33 ` [Bug c++/15505] " b dot perschbacher at att dot net
2004-05-18 15:39 ` pinskia at gcc dot gnu dot org
2004-05-18 15:42 ` bangerth at dealii dot org
2004-05-21  3:54 ` b dot perschbacher at att dot net
2004-05-21 12:38 ` giovannibajo at libero dot it

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).