]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 d2f56656de749916bfe11ce99eae60fc92a777a0..f7d586f8c99d9955f1290a2a20acff1a74d0ae09 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 98217c3892f84d20c661147e3573bd899bc382e6..5ee7500bfb5b937b06cfd15139f098c945b7f8e2 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 82fd16a56ae6d9f90fdb6a134b9aeca983eaabdf..e65d85547d6a324ebb5576ed9d7672d8ea468135 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 6ad4d39de9331ca36b2ff2dde97f424563426e07..fa749973e3cebbf4ddb1897cb3a9c6b598c7e841 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 d23a3cdcc6a7da6661415cd873931e6f9ab7bbf0..52a148ade87af1d5382391ecac1aff9c0cd067e3 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');
+}