From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14525 invoked by alias); 20 Dec 2001 16:16:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 14460 invoked by uid 71); 20 Dec 2001 16:16:02 -0000 Date: Thu, 20 Dec 2001 08:16:00 -0000 Message-ID: <20011220161602.14451.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Robert Boehne Subject: Re: c++/4122: undefined reference to `non-virtual thunk to ...' Reply-To: Robert Boehne X-SW-Source: 2001-12/txt/msg01006.txt.bz2 List-Id: The following reply was made to PR c++/4122; it has been noted by GNATS. From: Robert Boehne To: Jason Merrill Cc: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, juergen@monocerus.demon.co.uk, boehme@informatik.hu-berlin.de, loewis@informatik.hu-berlin.de, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, michael@ritzert.de, gcc-patches@gcc.gnu.org Subject: Re: c++/4122: undefined reference to `non-virtual thunk to ...' Date: Thu, 20 Dec 2001 10:10:00 -0600 This is a multi-part message in MIME format. --------------0667AD6289937F11086786AC Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jason Merrill wrote: > > No, it should never be necessary to generate thunks with the vtable; if > there's a thunk missing, either it should be generated with the function or > it should not be needed. > > Jason Jason: If this statement is true, what is the correct fix for PR4122? As it is now gcc 3.x is unusable with multiple virtual inheritence, this patch works to fix that, but if you have a suggestion for a more elegant fix I would like to hear it. I must admit that I'm not sure why this patch was necessry, or why it works, so any details you could explain (small words please ;) would be greatly appreciated. I've altered the test case a bit to clarify the problem and attached it to this message. In this case, the instantiated object has two virtual ancestors. The class at the top of the inheritence tree defines two virtual functions for wich the thunks are unresolved at link time. Thanks, Robert -- Robert Boehne Software Engineer Ricardo Software Chicago Technical Center TEL: (630)789-0003 x. 238 FAX: (630)789-0127 email: rboehne@ricardo-us.com --------------0667AD6289937F11086786AC Content-Type: text/plain; charset=us-ascii; name="pr4122-test.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pr4122-test.cpp" //////////////////////////////////////////////////////////////////// // PR4122 Demo // Multiple (virtual) inheritence is broken. // The code below has the class heirarchy shown below. The keyword // "virtual" is used to specify that only one instance of the given // class will be instantiated in the tree. Take out the virtual // keyword and the class with then compile. // // [ServantBase] // / \ // / \ // [RefCountServantBase] [IRObject] // \ / \ // \ / \ // [IRObject_impl] [Container] // \ / // \ / // [Container_impl] // /////////////////////////////////////////////////////////////////// class ServantBase { public: virtual void _non_existent() {}; virtual void _ami_existent() {}; virtual ~ServantBase() {}; }; class RefCountServantBase : virtual public ServantBase { }; class IRObject : virtual public ServantBase { }; class IRObject_impl : virtual public RefCountServantBase, virtual public IRObject { }; class Container : virtual public IRObject { }; class Container_impl : public Container, public IRObject_impl { }; int main() { Container_impl x; IRObject_impl y; } --------------0667AD6289937F11086786AC--