Commit 18141e4c by Jason Merrill Committed by Jason Merrill

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
parent b8d446d4
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 Lwis <loewis@informatik.hu-berlin.de> 1998-09-25 Martin von Lwis <loewis@informatik.hu-berlin.de>
* decl.c (lookup_namespace_name): If the name is a namespace, * decl.c (lookup_namespace_name): If the name is a namespace,
......
...@@ -2236,6 +2236,8 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p) ...@@ -2236,6 +2236,8 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
if (!decl) if (!decl)
continue; continue;
} }
else if (DECL_NAME (field) == NULL_TREE)
continue;
else else
{ {
decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
...@@ -2304,18 +2306,16 @@ finish_anon_union (anon_union_decl) ...@@ -2304,18 +2306,16 @@ finish_anon_union (anon_union_decl)
main_decl = build_anon_union_vars (anon_union_decl, &elems, main_decl = build_anon_union_vars (anon_union_decl, &elems,
static_p, external_p); static_p, external_p);
if (main_decl == NULL_TREE)
{
warning ("anonymous union with no members");
return;
}
if (static_p) if (static_p)
{ {
if (main_decl) make_decl_rtl (main_decl, 0, toplevel_bindings_p ());
{ DECL_RTL (anon_union_decl) = DECL_RTL (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;
}
} }
/* The following call assumes that there are never any cleanups /* The following call assumes that there are never any cleanups
......
...@@ -466,12 +466,12 @@ get_base_distance (parent, binfo, protect, path_ptr) ...@@ -466,12 +466,12 @@ get_base_distance (parent, binfo, protect, path_ptr)
return -3; return -3;
/* If they gave us the real vbase binfo, which isn't in the main binfo /* 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 if (rval == -1 && TREE_CODE (parent) == TREE_VEC
&& parent == binfo_member (BINFO_TYPE (parent), && parent == binfo_member (BINFO_TYPE (parent),
CLASSTYPE_VBASECLASSES (type))) CLASSTYPE_VBASECLASSES (type)))
{ {
my_friendly_abort (980901);
my_friendly_assert (BINFO_INHERITANCE_CHAIN (parent) == binfo, 980827); my_friendly_assert (BINFO_INHERITANCE_CHAIN (parent) == binfo, 980827);
new_binfo = parent; new_binfo = parent;
rval = 1; rval = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment