* 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
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.
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
/* 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)
{
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;
}
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');
+}