tree.c (member_p): New fn.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 30 Mar 1998 10:56:25 +0000 (10:56 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 30 Mar 1998 10:56:25 +0000 (05:56 -0500)
* tree.c (member_p): New fn.
* decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
initializing class members.
* cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
* ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.

From-SVN: r18909

gcc/cp/ChangeLog
gcc/cp/cp-tree.def
gcc/cp/decl2.c
gcc/cp/ptree.c
gcc/cp/tree.c

index d2f5665..f7d586f 100644 (file)
@@ -1,5 +1,12 @@
 Mon Mar 30 08:55:42 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * tree.c (member_p): New fn.
+       * decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
+       initializing class members.
+
+       * cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
+       * ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.
+
        * call.c (build_method_call): Handle non-scoped destructors, too.
        * pt.c (tsubst_copy): Likewise.
 
index 98217c3..5ee7500 100644 (file)
@@ -120,7 +120,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
    The LEVEL is the level of the parameter when we are worrying about
    the types of things; the ORIG_LEVEL is the level when we are
    worrying about instantiating things.  */
-DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'c', 
+DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 
             /* The addition of (sizeof(char*) - 1) in the next
                expression is to ensure against the case where
                sizeof(char*) does not evenly divide
index 82fd16a..e65d855 100644 (file)
@@ -3007,8 +3007,12 @@ finish_file ()
 
              /* 9.5p5: The initializer of a static member of a class has
                 the same access rights as a member function.  */
-             DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl);
-             DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
+             if (member_p (decl))
+               {
+                 DECL_CLASS_CONTEXT (current_function_decl)
+                   = DECL_CONTEXT (decl);
+                 DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
+               }
 
              if (protect)
                {
index 6ad4d39..fa74997 100644 (file)
@@ -175,6 +175,12 @@ lang_print_xnode (file, node, indent)
       print_node (file, "value", BINDING_VALUE (node), indent+4);
       print_node (file, "chain", TREE_CHAIN (node), indent+4);
       break;
+    case TEMPLATE_PARM_INDEX:
+      indent_to (file, indent + 3);
+      fprintf (file, "index %d level %d orig_level %d",
+              TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL (node),
+              TEMPLATE_PARM_ORIG_LEVEL (node));
+      break;
     default:
       break;
     }
index d23a3cd..52a148a 100644 (file)
@@ -2183,3 +2183,13 @@ varargs_function_p (function)
       return 0;
   return 1;
 }
+
+/* Returns 1 if decl is a member of a class.  */
+
+int
+member_p (decl)
+     tree decl;
+{
+  tree ctx = DECL_CONTEXT (decl);
+  return (ctx && TREE_CODE_CLASS (TREE_CODE (ctx)) == 't');
+}