From 18141e4c189dc4a75e876910624301dd82475758 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 25 Sep 1998 21:34:50 +0000 Subject: [PATCH] search.c (get_base_distance): Remove assert. * search.c (get_base_distance): Remove assert. * decl2.c (build_anon_union_vars): Don't process a field with no name. (finish_anon_union): Also complain about local anon unions with no members. From-SVN: r22597 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/decl2.c | 20 ++++++++++---------- gcc/cp/search.c | 4 ++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc6ad1ec62c..07941166e8e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +1998-09-25 Jason Merrill + + * search.c (get_base_distance): Remove assert. + + * decl2.c (build_anon_union_vars): Don't process a field with no + name. + (finish_anon_union): Also complain about local anon unions with no + members. + 1998-09-25 Martin von Löwis * decl.c (lookup_namespace_name): If the name is a namespace, diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 76abe6801b4..7faaf5546cf 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2236,6 +2236,8 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p) if (!decl) continue; } + else if (DECL_NAME (field) == NULL_TREE) + continue; else { decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); @@ -2304,18 +2306,16 @@ finish_anon_union (anon_union_decl) main_decl = build_anon_union_vars (anon_union_decl, &elems, static_p, external_p); + if (main_decl == NULL_TREE) + { + warning ("anonymous union with no members"); + return; + } + if (static_p) { - if (main_decl) - { - make_decl_rtl (main_decl, 0, toplevel_bindings_p ()); - DECL_RTL (anon_union_decl) = DECL_RTL (main_decl); - } - else - { - warning ("anonymous union with no members"); - return; - } + make_decl_rtl (main_decl, 0, toplevel_bindings_p ()); + DECL_RTL (anon_union_decl) = DECL_RTL (main_decl); } /* The following call assumes that there are never any cleanups diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 6de2d740557..3c04170facb 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -466,12 +466,12 @@ get_base_distance (parent, binfo, protect, path_ptr) return -3; /* If they gave us the real vbase binfo, which isn't in the main binfo - tree, deal with it. */ + tree, deal with it. This happens when we are called from + expand_upcast_fixups. */ if (rval == -1 && TREE_CODE (parent) == TREE_VEC && parent == binfo_member (BINFO_TYPE (parent), CLASSTYPE_VBASECLASSES (type))) { - my_friendly_abort (980901); my_friendly_assert (BINFO_INHERITANCE_CHAIN (parent) == binfo, 980827); new_binfo = parent; rval = 1; -- 2.30.2