bjorng@spirit.nada.kth.se (Bj|rn Gr|nvall) (05/22/89)
MACHINE
sun4 running os4.01
VERSION
g++ 1.35.0+
BUG DESCRIPTION
When calling the virtual base class destructor the wrong this pointer
is passed. Search for *** here it is ***.
Script started on Mon May 22 10:28:48 1989
spirit-1> cat tst.cc
// -*- C++ -*-
#include <stream.h>
#define sp <<" "
#define nl <<"\n"
class base {
protected:
int i;
public:
base() { cout << int(&i) sp << "making base\n"; }
~base() { cout << int(&i) sp << "deleting base\n"; }
};
class left : public virtual base {
public:
left() { cout << int(&i) sp << "making left\n"; }
~left() { cout << int(&i) sp << "deleting left\n"; }
};
class right : public virtual base {
public:
right() { cout << int(&i) sp << "making right\n"; }
~right() { cout << int(&i) sp << "deleting right\n"; }
};
class derived : public left, public right, public virtual base {
public:
derived() : left(), right() { cout << int(&i) sp << "making derived\n"; }
~derived() { cout << int(&i) sp << "deleting derived\n"; }
};
int main() {
derived foo;
return 0;
}
spirit-2> g++ -v tst.cc
g++ version 1.35.0+
/usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ tst.cc /tmp/cca01767.cpp
GNU CPP version 1.35
/usr/local/lib/gcc-cc1plus /tmp/cca01767.cpp -quiet -dumpbase tst.cc -noreg -version -o /tmp/cca01767.s
GNU C++ version 1.35.0+ (sparc) compiled by GNU C version 1.35.
as /tmp/cca01767.s -o tst.o
/usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o tst.o -lg++ /usr/local/lib/gcc-gnulib -lc
spirit-3> ./a.out
-134219356 making base
-134219356 making left
-134219356 making right
-134219356 making derived
-134219356 deleting derived
-134219356 deleting right
-134219356 deleting left
-134219368 deleting base <- *** here it is ***.
spirit-4> exit
exit
script done on Mon May 22 10:29:25 1989