aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/repo.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2000-07-04 03:47:11 -0400
committerJason Merrill <jason@gcc.gnu.org>2000-07-04 03:47:11 -0400
commit90418208f9263454e7a327fb74ce9e60cab0e944 (patch)
treef2fb5fe0f2f39a6d019d0aced8f4989911570843 /gcc/cp/repo.c
parent692e9bd5d0c1e0318a69e3d9e8533abd9a985660 (diff)
downloadgcc-90418208f9263454e7a327fb74ce9e60cab0e944.zip
gcc-90418208f9263454e7a327fb74ce9e60cab0e944.tar.gz
gcc-90418208f9263454e7a327fb74ce9e60cab0e944.tar.bz2
repo.c (repo_get_id): Handle the case where a class with virtual bases has a null TYPE_BINFO_VTABLE.
* repo.c (repo_get_id): Handle the case where a class with virtual bases has a null TYPE_BINFO_VTABLE. * parse.y (member_init): Just pass in the type. * init.c (expand_member_init): Handle getting a type. * decl.c (finish_function): Warn if a function has no return statement. Suggested by Andrew Koenig. * typeck.c (check_return_expr): Do set current_function_returns_value if we got an error_mark_node. From-SVN: r34863
Diffstat (limited to 'gcc/cp/repo.c')
-rw-r--r--gcc/cp/repo.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 0d3879e..add13dd 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -97,13 +97,36 @@ repo_get_id (t)
{
if (TYPE_P (t))
{
+ tree vtable;
+
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
See g++.pt/instantiate4.C. */
if (!COMPLETE_TYPE_P (t) || TYPE_BEING_DEFINED (t))
my_friendly_abort (981113);
- t = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
+ vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
+
+ /* If we don't have a primary vtable, try looking for a secondary
+ vtable. */
+ if (vtable == NULL_TREE && !flag_new_abi
+ && TYPE_USES_VIRTUAL_BASECLASSES (t))
+ {
+ tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
+ int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ for (i = 0; i < n_baselinks; ++i)
+ {
+ tree base_binfo = TREE_VEC_ELT (binfos, i);
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ vtable = get_vtbl_decl_for_binfo (base_binfo);
+ if (vtable)
+ break;
+ }
+ }
+ }
+
+ t = vtable;
if (t == NULL_TREE)
return t;
}