public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <200106220906.LAA02392@kepler.ibp.de> (raw)

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


                 reply	other threads:[~2001-06-22  2:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200106220906.LAA02392@kepler.ibp.de \
    --to=markus@ibp.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).