diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-04-27 00:02:52 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-04-27 00:02:52 +0000 |
commit | 86eab6f69a953c249635a33d0b07fb46670a7962 (patch) | |
tree | db07e29e2aae578ad43f1267c5fad2f31696ff6a /gcc | |
parent | 93dfdf16a562e674ce8133c6f547b7bb3d36c241 (diff) | |
download | gcc-86eab6f69a953c249635a33d0b07fb46670a7962.zip gcc-86eab6f69a953c249635a33d0b07fb46670a7962.tar.gz gcc-86eab6f69a953c249635a33d0b07fb46670a7962.tar.bz2 |
search.c (is_subobject_of_p): Make sure we're looking at the right baseclasses.
* search.c (is_subobject_of_p): Make sure we're looking at the
right baseclasses.
From-SVN: r26669
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/search.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/lookup15.C | 37 |
3 files changed, 47 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4c8b67f..3124a49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-04-26 Mark Mitchell <mark@codesourcery.com> + + * search.c (is_subobject_of_p): Make sure we're looking at the + right baseclasses. + 1999-04-26 Marc Espie <espie@cvs.openbsd.org> * Make-lang.in (cplib2.ready): Don't depend on phony targets. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 7ce65e6..ca98daa 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1065,13 +1065,17 @@ is_subobject_of_p (parent, binfo) tree binfos; int i, n_baselinks; + /* We want to canonicalize for comparison purposes. But, when we + iterate through basetypes later, we want the binfos from the + original hierarchy. That's why we have to calculate BINFOS + first, and then canonicalize. */ + binfos = BINFO_BASETYPES (binfo); parent = canonical_binfo (parent); binfo = canonical_binfo (binfo); if (parent == binfo) return 1; - binfos = BINFO_BASETYPES (binfo); n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; /* Process and/or queue base types. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup15.C b/gcc/testsuite/g++.old-deja/g++.other/lookup15.C new file mode 100644 index 0000000..be9096a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup15.C @@ -0,0 +1,37 @@ +// Build don't link: +// Origin: Benjamin Kosnik <bkoz@cygnus.com> + +class b +{ + int j; +public: + b(int a = 6): j(a) {} + void imbue(int a) {++j;} +}; + +class d: public b +{ + int k; +public: + d(int a = 7): b(a), k(a) {} + void imbue(int a) {++k;} +}; + +//virtual public kills, public ok +class mostd: virtual public d +{ + int l; +public: + mostd(int a = 9): d(a), l(a) {} +}; + +int main() { + + d dobj; + dobj.imbue(5); + + mostd mobj; + mobj.imbue(5); + + return 0; +} |