public inbox for gnats-prs@sourceware.org
help / color / mirror / Atom feed
From: shure@innoveda.com
To: gnats-gnats@sourceware.cygnus.com
Subject: gnats/227: no pointer adjustment in covariant returns with multiple inheritance
Date: Tue, 31 Jul 2001 00:44:00 -0000	[thread overview]
Message-ID: <20010731073704.3968.qmail@sourceware.cygnus.com> (raw)

>Number:         227
>Category:       gnats
>Synopsis:       no pointer adjustment in covariant returns with multiple inheritance
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 31 00:44:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     shure@innoveda.com
>Release:        gcc-3.0, gcc-2.95.2
>Organization:
>Environment:
sparc solaris 2.5 (not relevant)
>Description:
In the following test case:

#include <iostream.h>

class A {
public:
  virtual A* getThis() { return this; }
};

class B {
int a;
public:
  virtual B* getThis() { return this; }
};

class AB : public A, public B {
public:
  virtual AB* getThis() { return this; }
};

int main () {
  using namespace std;
  AB* ab = new AB();
  A* a = ab;
  B* b = ab;
  cout << a << " " << a->getThis() <<  endl;
  cout << b << " " << b->getThis() <<  endl;
  return 0;
}

The values of 'b' and 'b->getThis()' are different.

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2001-07-31  0:44 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=20010731073704.3968.qmail@sourceware.cygnus.com \
    --to=shure@innoveda.com \
    --cc=gnats-gnats@sourceware.cygnus.com \
    /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).