1999-05-19  Jason Merrill  <jason@yorick.cygnus.com>

	* call.c (find_scoped_type, resolve_scope_to_name): Lose.
	* class.c (finish_struct_1): Use CLASS_TYPE_P.
	* ptree.c (print_lang_type): Likewise.
	* typeck.c (build_modify_expr, c_expand_asm_operands): Use
	IS_AGGR_TYPE_CODE.
	* typeck2.c (digest_init): Likewise.

Index: gcc-2.95.2/gcc/cp/call.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/call.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 call.c
--- gcc-2.95.2/gcc/cp/call.c	1999/11/05 01:09:45	1.1.1.1
+++ gcc-2.95.2/gcc/cp/call.c	1999/11/05 06:08:58
@@ -42,7 +42,6 @@ extern tree ctor_label, dtor_label;
 static tree build_new_method_call PROTO((tree, tree, tree, tree, int));
 
 static tree build_field_call PROTO((tree, tree, tree, tree));
-static tree find_scoped_type PROTO((tree, tree, tree));
 static struct z_candidate * tourney PROTO((struct z_candidate *));
 static int joust PROTO((struct z_candidate *, struct z_candidate *, int));
 static int compare_ics PROTO((tree, tree));
@@ -162,130 +161,6 @@ build_field_call (basetype_path, instanc
     }
 
   return NULL_TREE;
-}
-
-static tree
-find_scoped_type (type, inner_name, inner_types)
-     tree type, inner_name, inner_types;
-{
-  tree tags = CLASSTYPE_TAGS (type);
-
-  while (tags)
-    {
-      /* The TREE_PURPOSE of an enum tag (which becomes a member of the
-	 enclosing class) is set to the name for the enum type.  So, if
-	 inner_name is `bar', and we strike `baz' for `enum bar { baz }',
-	 then this test will be true.  */
-      if (TREE_PURPOSE (tags) == inner_name)
-	{
-	  if (inner_types == NULL_TREE)
-	    return TYPE_MAIN_DECL (TREE_VALUE (tags));
-	  return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
-	}
-      tags = TREE_CHAIN (tags);
-    }
-
-  /* Look for a TYPE_DECL.  */
-  for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags))
-    if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name)
-      {
-	/* Code by raeburn.  */
-	if (inner_types == NULL_TREE)
-	  return tags;
-	return resolve_scope_to_name (TREE_TYPE (tags), inner_types);
-      }
-
-  return NULL_TREE;
-}
-
-/* Resolve an expression NAME1::NAME2::...::NAMEn to
-   the name that names the above nested type.  INNER_TYPES
-   is a chain of nested type names (held together by SCOPE_REFs);
-   OUTER_TYPE is the type we know to enclose INNER_TYPES.
-   Returns NULL_TREE if there is an error.  */
-
-tree
-resolve_scope_to_name (outer_type, inner_stuff)
-     tree outer_type, inner_stuff;
-{
-  register tree tmp;
-  tree inner_name, inner_type;
-
-  if (outer_type == NULL_TREE && current_class_type != NULL_TREE)
-    {
-      /* We first try to look for a nesting in our current class context,
-         then try any enclosing classes.  */
-      tree type = current_class_type;
-      
-      while (type && (TREE_CODE (type) == RECORD_TYPE
-		      || TREE_CODE (type) == UNION_TYPE))
-        {
-          tree rval = resolve_scope_to_name (type, inner_stuff);
-
-	  if (rval != NULL_TREE)
-	    return rval;
-	  type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
-	}
-    }
-
-  if (TREE_CODE (inner_stuff) == SCOPE_REF)
-    {
-      inner_name = TREE_OPERAND (inner_stuff, 0);
-      inner_type = TREE_OPERAND (inner_stuff, 1);
-    }
-  else
-    {
-      inner_name = inner_stuff;
-      inner_type = NULL_TREE;
-    }
-
-  if (outer_type == NULL_TREE)
-    {
-      tree x;
-      /* If we have something that's already a type by itself,
-	 use that.  */
-      if (IDENTIFIER_HAS_TYPE_VALUE (inner_name))
-	{
-	  if (inner_type)
-	    return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name),
-					  inner_type);
-	  return inner_name;
-	}
-      
-      x = lookup_name (inner_name, 0);
-
-      if (x && TREE_CODE (x) == NAMESPACE_DECL)
-	{
-	  x = lookup_namespace_name (x, inner_type);
-	  return x;
-	}
-      return NULL_TREE;
-    }
-
-  if (! IS_AGGR_TYPE (outer_type))
-    return NULL_TREE;
-
-  /* Look for member classes or enums.  */
-  tmp = find_scoped_type (outer_type, inner_name, inner_type);
-
-  /* If it's not a type in this class, then go down into the
-     base classes and search there.  */
-  if (! tmp && TYPE_BINFO (outer_type))
-    {
-      tree binfos = TYPE_BINFO_BASETYPES (outer_type);
-      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);
-	  tmp = resolve_scope_to_name (BINFO_TYPE (base_binfo), inner_stuff);
-	  if (tmp)
-	    return tmp;
-	}
-      tmp = NULL_TREE;
-    }
-
-  return tmp;
 }
 
 /* Returns nonzero iff the destructor name specified in NAME
Index: gcc-2.95.2/gcc/cp/class.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/class.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 class.c
--- gcc-2.95.2/gcc/cp/class.c	1999/11/05 01:09:45	1.1.1.1
+++ gcc-2.95.2/gcc/cp/class.c	1999/11/05 06:08:58
@@ -3522,8 +3522,7 @@ finish_struct_1 (t, warn_anon)
 	  while (TREE_CODE (type) == ARRAY_TYPE)
 	    type = TREE_TYPE (type);
 
-	  if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x)
-	      && ! TYPE_PTRMEMFUNC_P (type))
+          if (CLASS_TYPE_P (type))
 	    {
 	      /* Never let anything with uninheritable virtuals
 		 make it through without complaint.  */
Index: gcc-2.95.2/gcc/cp/ptree.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/ptree.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 ptree.c
--- gcc-2.95.2/gcc/cp/ptree.c	1999/11/05 01:09:46	1.1.1.1
+++ gcc-2.95.2/gcc/cp/ptree.c	1999/11/05 06:08:58
@@ -79,11 +79,7 @@ print_lang_type (file, node, indent)
       return;
     }
 
-  if (! (TREE_CODE (node) == RECORD_TYPE
-	 || TREE_CODE (node) == UNION_TYPE))
-    return;
-
-  if (!TYPE_LANG_SPECIFIC (node))
+  if (! CLASS_TYPE_P (node))
     return;
 
   indent_to (file, indent + 3);
Index: gcc-2.95.2/gcc/cp/typeck.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/typeck.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 typeck.c
--- gcc-2.95.2/gcc/cp/typeck.c	1999/11/05 01:09:46	1.1.1.1
+++ gcc-2.95.2/gcc/cp/typeck.c	1999/11/05 06:08:58
@@ -6122,8 +6122,7 @@ build_modify_expr (lhs, modifycode, rhs)
 	  /* Functions are not modifiable, even though they are
 	     lvalues.  */
 	  || TREE_CODE (TREE_TYPE (lhs)) == FUNCTION_TYPE
-	  || ((TREE_CODE (lhstype) == RECORD_TYPE
-	       || TREE_CODE (lhstype) == UNION_TYPE)
+          || (IS_AGGR_TYPE_CODE (TREE_CODE (lhstype))
 	      && C_TYPE_FIELDS_READONLY (lhstype))
 	  || (TREE_CODE (lhstype) == REFERENCE_TYPE
 	      && CP_TYPE_CONST_P (TREE_TYPE (lhstype)))))
@@ -7305,8 +7304,7 @@ c_expand_asm_operands (string, outputs, 
 	{
 	  tree type = TREE_TYPE (o[i]);
 	  if (CP_TYPE_CONST_P (type)
-	      || ((TREE_CODE (type) == RECORD_TYPE
-		   || TREE_CODE (type) == UNION_TYPE)
+              || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
 		  && C_TYPE_FIELDS_READONLY (type)))
 	    readonly_error (o[i], "modification by `asm'", 1);
 	}
Index: gcc-2.95.2/gcc/cp/typeck2.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/cp/typeck2.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 typeck2.c
--- gcc-2.95.2/gcc/cp/typeck2.c	1999/11/05 01:09:46	1.1.1.1
+++ gcc-2.95.2/gcc/cp/typeck2.c	1999/11/05 06:08:58
@@ -836,7 +836,7 @@ digest_init (type, init, tail)
       return error_mark_node;
     }
 
-  if (code == ARRAY_TYPE || code == RECORD_TYPE || code == UNION_TYPE)
+  if (code == ARRAY_TYPE || IS_AGGR_TYPE_CODE (code))
     {
       if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
 	{
