public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3356: Multiple inheritance and throw()
@ 2001-06-22  2:16 markus
  0 siblings, 0 replies; only message in thread
From: markus @ 2001-06-22  2:16 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-22  2:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22  2:16 c++/3356: Multiple inheritance and throw() markus

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).