Xref: utzoo comp.lang.c++:10112 gnu.g++.help:50 Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bloom-beacon!eru!hagbard!sunic!chalmers.se!appli!niklas From: niklas@appli.se (Niklas Hallqvist) Newsgroups: comp.lang.c++,gnu.g++.help Subject: Yet another G++ question Summary: Should pure virtual destructors work this way? Keywords: virtual abstract baseclass bug G++ Message-ID: <1176@appli.se> Date: 26 Oct 90 00:31:15 GMT Followup-To: comp.lang.c++ Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN Lines: 23 Is this code really legal? G++ 1.37.1 (+ some early bug fixes of 1.37.2) says so! class A { public: virtual ~A() = 0; }; class B : virtual public A {}; void foo(void) { B b; } Doesn't B have to implement a destructor when deriving <> from A? Why, if that's the case? If I derive B non-virtually from A, I get the expected error message. Is it a bug? If so, is it fixed in the current version of G++ (whatever that is)? If not, how can i ensure that every class deriving from A (virtually or not) must implement a destructor? I did really forget to write down a destructor, but I trusted the compiler to tell me my mistakes, since I was awfully concentrated when writing the abstract base class, just in order to prevent such a malicious fault go unnoticed. Niklas -- Niklas Hallqvist Phone: +46-(0)31-40 75 00 Applitron Datasystem Fax: +46-(0)31-83 39 50 Molndalsvagen 95 Email: niklas@appli.se S-412 63 GOTEBORG, Sweden mcsun!sunic!chalmers!appli!niklas