OSDN Git Service

* pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jun 2000 20:54:48 +0000 (20:54 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Jun 2000 20:54:48 +0000 (20:54 +0000)
        (tsubst_friend_function): Copy it here.

        * decl.c (grok_op_properties): Fix typo.

        * decl2.c (delete_sanity): Clarify warning, avoid failure on
        deleting void*.

        * pt.c (check_explicit_specialization): Clarify error.

        * decl.c (pushdecl): Also pull out one of the FUNCTION_DECLs from
        an old OVERLOAD when we're declaring a non-function.
        (pushdecl, destroy_local_var): Check for error_mark_node.
        (warn_extern_redeclared_static): Also bail early if
        we're a CONST_DECL.
        (push_overloaded_decl): Ignore an old error_mark_node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34652 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/pt.c

index e05c3d3..1f655b3 100644 (file)
@@ -1,3 +1,22 @@
+2000-06-22  Jason Merrill  <jason@redhat.com>
+
+       * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
+       (tsubst_friend_function): Copy it here.
+
+       * decl.c (grok_op_properties): Fix typo.
+
+       * decl2.c (delete_sanity): Clarify warning, avoid failure on
+       deleting void*.
+
+       * pt.c (check_explicit_specialization): Clarify error.
+
+       * decl.c (pushdecl): Also pull out one of the FUNCTION_DECLs from
+       an old OVERLOAD when we're declaring a non-function.
+       (pushdecl, destroy_local_var): Check for error_mark_node.
+       (warn_extern_redeclared_static): Also bail early if 
+       we're a CONST_DECL.
+       (push_overloaded_decl): Ignore an old error_mark_node.
+
 2000-06-22  Nathan Sidwell  <nathan@codesourcery.com>
 
        * call.c (build_x_va_arg): Check if in a template decl.
index 9e06a48..5451306 100644 (file)
@@ -3092,7 +3092,8 @@ warn_extern_redeclared_static (newdecl, olddecl)
   tree name;
 
   if (TREE_CODE (newdecl) == TYPE_DECL
-      || TREE_CODE (newdecl) == TEMPLATE_DECL)
+      || TREE_CODE (newdecl) == TEMPLATE_DECL
+      || TREE_CODE (newdecl) == CONST_DECL)
     return;
 
   /* Don't get confused by static member functions; that's a different
@@ -3863,14 +3864,20 @@ pushdecl (x)
         actually the same as the function we are declaring.  (If
         there is one, we have to merge our declaration with the
         previous declaration.)  */
-      if (t && TREE_CODE (t) == OVERLOAD && TREE_CODE (x) == FUNCTION_DECL)
+      if (t && TREE_CODE (t) == OVERLOAD)
        {
          tree match;
 
-         for (match = t; match; match = OVL_NEXT (match))
-           if (DECL_ASSEMBLER_NAME (OVL_CURRENT (t))
-               == DECL_ASSEMBLER_NAME (x))
-             break;
+         if (TREE_CODE (x) == FUNCTION_DECL)
+           for (match = t; match; match = OVL_NEXT (match))
+             {
+               if (DECL_ASSEMBLER_NAME (OVL_CURRENT (t))
+                   == DECL_ASSEMBLER_NAME (x))
+                 break;
+             }
+         else
+           /* Just choose one.  */
+           match = t;
 
          if (match)
            t = OVL_CURRENT (match);
@@ -3972,7 +3979,7 @@ pushdecl (x)
       if (TREE_CODE (x) == TYPE_DECL)
        {
          tree type = TREE_TYPE (x);
-          if (DECL_SOURCE_LINE (x) == 0)
+         if (DECL_SOURCE_LINE (x) == 0)
             {
              if (TYPE_NAME (type) == 0)
                TYPE_NAME (type) = x;
@@ -4010,6 +4017,7 @@ pushdecl (x)
          tree decl;
 
          if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE
+             && IDENTIFIER_NAMESPACE_VALUE (name) != error_mark_node
              && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name))
                  || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name))))
            decl = IDENTIFIER_NAMESPACE_VALUE (name);
@@ -4577,6 +4585,9 @@ push_overloaded_decl (decl, flags)
                return fn;
            }
        }
+      else if (old == error_mark_node)
+       /* Ignore the undefined symbol marker.  */
+       old = NULL_TREE;
       else
        {
          cp_error_at ("previous non-function declaration `%#D'", old);
@@ -8022,7 +8033,8 @@ destroy_local_var (decl)
     return;
 
   /* And only things with destructors need cleaning up.  */
-  if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
+  if (type == error_mark_node
+      || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
     return;
 
   if (TREE_CODE (decl) == VAR_DECL &&
@@ -12583,7 +12595,7 @@ grok_op_properties (decl, virtualp, friendp)
                  break;
 
                case PREDECREMENT_EXPR:
-                 operator_code = PREDECREMENT_EXPR;
+                 operator_code = POSTDECREMENT_EXPR;
                  break;
 
                default:
index 75fed46..b034d78 100644 (file)
@@ -1283,8 +1283,11 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
 
   /* Deleting ptr to void is undefined behaviour [expr.delete/3].  */
   if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
-    cp_warning ("`%T' is not a pointer-to-object type", type);
-  
+    {
+      cp_warning ("deleting `%T' is undefined", type);
+      doing_vec = 0;
+    }
+
   /* An array can't have been allocated by new, so complain.  */
   if (TREE_CODE (t) == ADDR_EXPR
       && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL
index 6fcc9e4..af0c7c4 100644 (file)
@@ -1300,8 +1300,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
          /* This case handles bogus declarations like template <>
             template <class T> void f<int>(); */
 
-         cp_error ("template-id `%D' in declaration of primary template",
-                   declarator);
+         if (uses_template_parms (declarator))
+           cp_error ("partial specialization `%D' of function template",
+                     declarator);
+         else
+           cp_error ("template-id `%D' in declaration of primary template",
+                     declarator);
          return decl;
        }
 
@@ -4507,7 +4511,11 @@ tsubst_friend_function (decl, args)
      instantiation of anything.  */
   DECL_USE_TEMPLATE (new_friend) = 0;
   if (TREE_CODE (decl) == TEMPLATE_DECL)
-    DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
+    {
+      DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
+      DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (new_friend))
+       = DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (decl));
+    }
 
   /* The mangled name for the NEW_FRIEND is incorrect.  The call to
      tsubst will have resulted in a call to
@@ -5727,6 +5735,7 @@ tsubst_decl (t, args, type, in_decl)
        TREE_CHAIN (r) = NULL_TREE;
        DECL_PENDING_INLINE_INFO (r) = 0;
        DECL_PENDING_INLINE_P (r) = 0;
+       DECL_SAVED_TREE (r) = NULL_TREE;
        TREE_USED (r) = 0;
        if (DECL_CLONED_FUNCTION (r))
          {