86th Cygnus<->FSF quick merge
authorMike Stump <mrs@gcc.gnu.org>
Fri, 17 May 1996 17:08:27 +0000 (17:08 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 17 May 1996 17:08:27 +0000 (17:08 +0000)
From-SVN: r12008

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/expr.c
gcc/cp/method.c
gcc/cp/pt.c
gcc/cp/typeck.c

index 4b4c2b85df870f0f8237fede284959b47ef97de2..f0dd601c72a8bce96639c2d528f0d3522475c64e 100644 (file)
@@ -3,6 +3,31 @@ Sat May 11 04:33:50 1996  Doug Evans  <dje@canuck.cygnus.com>
        * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
        (finish_file): Likewise.
 
+Thu May 16 15:29:33 1996  Bob Manson  <manson@charmed.cygnus.com>
+
+       * expr.c (do_case): Don't try to dereference null TREE_TYPEs
+       when checking for pointer types.
+
+Thu May 16 13:38:58 1996  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (instantiate_class_template): Remove obsolete check for
+       access declarations.
+
+Thu May 16 13:34:15 1996  Mike Stump  <mrs@cygnus.com>
+
+       * call.c (build_overload_call): Simplify calls to
+       build_overload_call by removing last parameter.
+       (build_method_call): Ditto.
+       * cp-tree.h: Ditto.
+       * method.c (build_opfncall): Ditto.
+       * typeck.c (build_x_function_call): Ditto.
+
+Thu May 16 13:15:43 1996  Mike Stump  <mrs@cygnus.com>
+
+       * call.c (default_parm_conversions): Factor out common code.
+       (build_method_call): Use it.
+       (build_overload_call_real): Use it.
+
 Wed May 15 14:46:14 1996  Mike Stump  <mrs@cygnus.com>
 
        * call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
index f51d09b8783cabde73f1bb929a8cd5164001c36a..6e2132de058dda402d27465a0d7edc684c6070e1 100644 (file)
@@ -1584,6 +1584,36 @@ build_call (function, result_type, parms)
   return function;
 }
 
+static tree
+default_parm_conversions (parms, last)
+     tree parms, *last;
+{
+  tree parm, parmtypes = NULL_TREE;
+
+  *last = NULL_TREE;
+
+  for (parm = parms; parm; parm = TREE_CHAIN (parm))
+    {
+      tree t = TREE_TYPE (TREE_VALUE (parm));
+
+      if (TREE_CODE (t) == OFFSET_TYPE
+         || TREE_CODE (t) == METHOD_TYPE
+         || TREE_CODE (t) == FUNCTION_TYPE)
+       {
+         TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
+         t = TREE_TYPE (TREE_VALUE (parm));
+       }
+
+      if (t == error_mark_node)
+         return error_mark_node;
+
+      *last = build_tree_list (NULL_TREE, t);
+      parmtypes = chainon (parmtypes, *last);
+    }
+
+  return parmtypes;
+}
+
 
 /* Build something of the form ptr->method (args)
    or object.method (args).  This can also build
@@ -1988,35 +2018,10 @@ build_method_call (instance, name, parms, basetype_path, flags)
 
   save_basetype = TYPE_MAIN_VARIANT (basetype);
 
-  last = NULL_TREE;
-  for (parmtypes = NULL_TREE, parm = parms; parm; parm = TREE_CHAIN (parm))
+  parmtypes = default_parm_conversions (parms, &last);
+  if (parmtypes == error_mark_node)
     {
-      tree t = TREE_TYPE (TREE_VALUE (parm));
-      if (TREE_CODE (t) == OFFSET_TYPE)
-       {
-         /* Convert OFFSET_TYPE entities to their normal selves.  */
-         TREE_VALUE (parm) = resolve_offset_ref (TREE_VALUE (parm));
-         t = TREE_TYPE (TREE_VALUE (parm));
-       }
-      if (TREE_CODE (t) == METHOD_TYPE)
-       {
-         cp_pedwarn ("assuming & on `%E'", TREE_VALUE (parm));
-         TREE_VALUE (parm) = build_unary_op (ADDR_EXPR, TREE_VALUE (parm), 0);
-       }
-#if 0
-      /* This breaks reference-to-array parameters.  */
-      if (TREE_CODE (t) == ARRAY_TYPE)
-       {
-         /* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
-            This eliminates needless calls to `compute_conversion_costs'.  */
-         TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
-         t = TREE_TYPE (TREE_VALUE (parm));
-       }
-#endif
-      if (t == error_mark_node)
-       return error_mark_node;
-      last = build_tree_list (NULL_TREE, t);
-      parmtypes = chainon (parmtypes, last);
+      return error_mark_node;
     }
 
   if (instance && IS_SIGNATURE (basetype))
@@ -2146,7 +2151,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
              cp->harshness = (struct harshness_code *)
                alloca ((len + 1) * sizeof (struct harshness_code));
 
-             result = build_overload_call (name, friend_parms, 0, cp);
+             result = build_overload_call_real (name, friend_parms, 0, cp, 1);
 
              /* If it turns out to be the one we were actually looking for
                 (it was probably a friend function), the return the
@@ -2429,14 +2434,16 @@ build_method_call (instance, name, parms, basetype_path, flags)
       && value_member (function, get_abstract_virtuals (basetype)))
     cp_error ("abstract virtual `%#D' called from constructor", function);
 
-  if (IS_SIGNATURE (basetype) && static_call_context)
+  if (IS_SIGNATURE (basetype))
     {
-      cp_error ("cannot call signature member function `%T::%D' without signature pointer/reference",
-               basetype, save_name);
-      return error_mark_node;
+      if (static_call_context)
+       {
+         cp_error ("cannot call signature member function `%T::%D' without signature pointer/reference",
+                   basetype, save_name);
+         return error_mark_node;
        }
-  else if (IS_SIGNATURE (basetype))
-    return build_signature_method_call (basetype, instance, function, parms);
+      return build_signature_method_call (basetype, instance, function, parms);
+    }
 
   function = DECL_MAIN_VARIANT (function);
   mark_used (function);
@@ -2632,7 +2639,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
 {
   /* must check for overloading here */
   tree functions, function, parm;
-  tree parmtypes = NULL_TREE, last = NULL_TREE;
+  tree parmtypes, last;
   register tree outer;
   int length;
   int parmlength = list_length (parms);
@@ -2648,31 +2655,14 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
       final_cp[1].h.code = EVIL_CODE;
     }
 
-  for (parm = parms; parm; parm = TREE_CHAIN (parm))
+  parmtypes = default_parm_conversions (parms, &last);
+  if (parmtypes == error_mark_node)
     {
-      register tree t = TREE_TYPE (TREE_VALUE (parm));
-
-      if (t == error_mark_node)
-       {
-         if (final_cp)
-           final_cp->h.code = EVIL_CODE;
-         return error_mark_node;
-       }
-      if (TREE_CODE (t) == OFFSET_TYPE)
-#if 0
-      /* This breaks reference-to-array parameters.  */
-         || TREE_CODE (t) == ARRAY_TYPE
-#endif
-       {
-         /* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
-            Also convert OFFSET_TYPE entities to their normal selves.
-            This eliminates needless calls to `compute_conversion_costs'.  */
-         TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
-         t = TREE_TYPE (TREE_VALUE (parm));
-       }
-      last = build_tree_list (NULL_TREE, t);
-      parmtypes = chainon (parmtypes, last);
+      if (final_cp)
+       final_cp->h.code = EVIL_CODE;
+      return error_mark_node;
     }
+
   if (last)
     TREE_CHAIN (last) = void_list_node;
   else
@@ -2891,10 +2881,9 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
 
 /* This requires a complete type on the result of the call.  */
 tree
-build_overload_call (fnname, parms, flags, final_cp)
+build_overload_call (fnname, parms, flags)
      tree fnname, parms;
      int flags;
-     struct candidate *final_cp;
 {
-  return build_overload_call_real (fnname, parms, flags, final_cp, 1);
+  return build_overload_call_real (fnname, parms, flags, (struct candidate *)0, 1);
 }
index cb850e077ce26d6755456b17f2497d7692779ad1..a1d59d68299e27bb627515a1bc4bc2ce5e60587e 100644 (file)
@@ -1944,7 +1944,7 @@ extern tree build_addr_func                       PROTO((tree));
 extern tree build_scoped_method_call           PROTO((tree, tree, tree, tree));
 extern tree build_method_call                  PROTO((tree, tree, tree, tree, int));
 extern tree build_overload_call_real           PROTO((tree, tree, int, struct candidate *, int));
-extern tree build_overload_call                        PROTO((tree, tree, int, struct candidate *));
+extern tree build_overload_call                        PROTO((tree, tree, int));
 
 /* in class.c */
 extern tree build_vbase_pointer                        PROTO((tree, tree));
index 7411a4eaa0d110e6282c02a311301e56e0167d15..343246f26e8065ef2284cfce15775d4e3646164c 100644 (file)
@@ -374,7 +374,8 @@ do_case (start, end)
 {
   tree value1 = NULL_TREE, value2 = NULL_TREE, label;
 
-  if (start && POINTER_TYPE_P (TREE_TYPE (start)))
+  if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE 
+      && POINTER_TYPE_P (TREE_TYPE (start)))
     error ("pointers are not permitted as case values");
 
   if (end && pedantic)
index 79761e9d46496411d17c3345fae03339b8916fa4..321492370ea143001c500464d3454a0f2008a5e7 100644 (file)
@@ -1233,8 +1233,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
        tree args = tree_cons (NULL_TREE, xarg2, arg3);
        fnname = ansi_opname[(int) code];
        if (flags & LOOKUP_GLOBAL)
-         return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN,
-                                     (struct candidate *)0);
+         return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN);
 
        rval = build_method_call
          (build_indirect_ref (build1 (NOP_EXPR, xarg1, error_mark_node),
@@ -1258,8 +1257,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
        if (flags & LOOKUP_GLOBAL)
          return build_overload_call (fnname,
                                      build_tree_list (NULL_TREE, xarg1),
-                                     flags & LOOKUP_COMPLAIN,
-                                     (struct candidate *)0);
+                                     flags & LOOKUP_COMPLAIN);
        arg1 = TREE_TYPE (xarg1);
 
        /* This handles the case where we're trying to delete
@@ -1481,8 +1479,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
     {
       parms = tree_cons (NULL_TREE, xarg1,
                         build_tree_list (NULL_TREE, xarg2));
-      rval = build_overload_call (fnname, parms, flags,
-                                 (struct candidate *)0);
+      rval = build_overload_call (fnname, parms, flags);
     }
 
   return rval;
index 0addffdee912173b4714641628a7cb6506f9ee7f..536e6c6be561b3dec798e7fc912df69aa18a715a 100644 (file)
@@ -1182,8 +1182,7 @@ instantiate_class_template (type)
     {
       tree tmp;
       for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
-       if (TREE_CODE (tmp) == FIELD_DECL
-           && TREE_CODE (DECL_NAME (tmp)) != SCOPE_REF)
+       if (TREE_CODE (tmp) == FIELD_DECL)
          require_complete_type (tmp);
 
       /* XXX handle attributes */
index 507150ca1bac557c6b73dc9367eeddd2320a8af2..e1fac0d9341fc9e90bb817296010427199e8668c 100644 (file)
@@ -1430,7 +1430,7 @@ decay_conversion (exp)
   register tree type = TREE_TYPE (exp);
   register enum tree_code code = TREE_CODE (type);
 
-  if (code == OFFSET_TYPE /* || TREE_CODE (exp) == OFFSET_REF */ )
+  if (code == OFFSET_TYPE)
     {
       if (TREE_CODE (exp) == OFFSET_REF)
        return decay_conversion (resolve_offset_ref (exp));
@@ -2370,7 +2370,7 @@ build_x_function_call (function, params, decl)
              (function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0);
          else if (DECL_CHAIN (val) != NULL_TREE)
            return build_overload_call
-             (function, params, LOOKUP_COMPLAIN, (struct candidate *)0);
+             (function, params, LOOKUP_COMPLAIN);
          else
            my_friendly_abort (360);
        }