gnats-prs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnats/227: no pointer adjustment in covariant returns with multiple inhe


From: shure
Subject: gnats/227: no pointer adjustment in covariant returns with multiple inheritance
Date: 31 Jul 2001 07:37:04 -0000

>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:     address@hidden
>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 via email to

[Prev in Thread] Current Thread [Next in Thread]