public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Robert Boehne <rboehne@ricardo-us.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/4122: undefined reference to `non-virtual thunk to ...' Date: Thu, 20 Dec 2001 08:16:00 -0000 [thread overview] Message-ID: <20011220161602.14451.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/4122; it has been noted by GNATS. From: Robert Boehne <rboehne@ricardo-us.com> To: Jason Merrill <jason@redhat.com> 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--
next reply other threads:[~2001-12-20 16:16 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-12-20 8:16 Robert Boehne [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-01-11 4:49 rodrigc 2002-01-10 7:46 Robert Boehne 2002-01-10 5:26 Michael Ritzert 2002-01-09 22:31 rodrigc 2001-12-21 4:56 Nathan Sidwell 2001-12-19 19:26 Jason Merrill 2001-12-19 18:56 Robert Boehne 2001-12-14 15:16 Robert Boehne 2001-08-25 3:46 michael
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=20011220161602.14451.qmail@sources.redhat.com \ --to=rboehne@ricardo-us.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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: linkBe 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).