public inbox for gnats-prs@sourceware.org
help / color / mirror / Atom feed
* gnats/227: no pointer adjustment in covariant returns with multiple inheritance
@ 2001-07-31  0:44 shure
  0 siblings, 0 replies; only message in thread
From: shure @ 2001-07-31  0:44 UTC (permalink / raw)
  To: gnats-gnats

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


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

only message in thread, other threads:[~2001-07-31  0:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-31  0:44 gnats/227: no pointer adjustment in covariant returns with multiple inheritance shure

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