search.c (get_base_distance): Remove assert.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 25 Sep 1998 21:34:50 +0000 (21:34 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 25 Sep 1998 21:34:50 +0000 (17:34 -0400)
* 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
gcc/cp/decl2.c
gcc/cp/search.c

index fc6ad1e..0794116 100644 (file)
@@ -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,
index 76abe68..7faaf55 100644 (file)
@@ -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
index 6de2d74..3c04170 100644 (file)
@@ -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;