diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-09-25 21:34:50 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-09-25 17:34:50 -0400 |
commit | 18141e4c189dc4a75e876910624301dd82475758 (patch) | |
tree | da1e28167f911e1a7bf564a7c5cb9effed7fa0af | |
parent | b8d446d46eddd7839040545a0175c9f60c81c63f (diff) | |
download | gcc-18141e4c189dc4a75e876910624301dd82475758.zip gcc-18141e4c189dc4a75e876910624301dd82475758.tar.gz gcc-18141e4c189dc4a75e876910624301dd82475758.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 20 | ||||
-rw-r--r-- | gcc/cp/search.c | 4 |
3 files changed, 21 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc6ad1e..0794116 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +1998-09-25 Jason Merrill <jason@yorick.cygnus.com> + + * 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 <loewis@informatik.hu-berlin.de> * decl.c (lookup_namespace_name): If the name is a namespace, diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 76abe68..7faaf55 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 6de2d74..3c04170 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; |