From mboxrd@z Thu Jan 1 00:00:00 1970 From: markus@ibp.de To: gcc-gnats@gcc.gnu.org Subject: c++/3356: Multiple inheritance and throw() Date: Fri, 22 Jun 2001 02:16:00 -0000 Message-id: <200106220906.LAA02392@kepler.ibp.de> X-SW-Source: 2001-06/msg00943.html List-Id: >Number: 3356 >Category: c++ >Synopsis: Multiple inheritance from a class that has a throw() destructor doesn't compile >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Fri Jun 22 02:16:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: >Release: 3.0 >Organization: >Environment: System: Linux kepler 2.2.14 #26 Tue Aug 1 15:33:53 CEST 2000 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc-3.0/configure : (reconfigured) ../gcc-3.0/configure --enable-threads : (reconfigured) ../gcc-3.0/configure --enable-threads --enable-c99 : (reconfigured) ../gcc-3.0/configure --enable-threads >Description: It is not possible to compile a class that inherits from two classes, one of which has a virtual destructor that is declared 'throw()'. In the following example, the 'virtual' keyword is necessary. If one declares 'throw()' destructor in class 'derived' the code compiles. If the destructor has no 'throw()', it doesn't. >How-To-Repeat: The compilation of the file ----------------------------------------------------------- class base { public: ~base(void) {} }; class no_throw { public: virtual ~no_throw(void) throw() {} }; class derived : public no_throw, public base { }; ----------------------------------------------------------- results in the messages ----------------------------------------------------------- cd ~/ make throw.o g++ -c -o throw.o throw.C throw.C:14: looser throw specifier for `virtual derived::~derived()' throw.C:10: overriding `virtual no_throw::~no_throw() throw ()' make: *** [throw.o] Error 1 Compilation exited abnormally with code 2 at Thu Jun 21 16:51:30 ----------------------------------------------------------- >Fix: >Release-Note: >Audit-Trail: >Unformatted: