+2000-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (pushclass): Remove #if 0'd code.
+ * cp-tree.h (overload_template_name): Remove.
+ * decl.c (store_bindings): Simplify.
+ (pop_from_top_level): Likewise.
+ * pt.c (overload_template_name): Remove.
+ (instantiate_decl): Don't call push_to_top_level if it's not
+ needed.
+
2000-12-28 Mark Mitchell <mark@codesourcery.com>
* pt.c (register_local_specialization): Don't return a value.
pushlevel_class ();
-#if 0
- if (CLASSTYPE_TEMPLATE_INFO (type))
- overload_template_name (type);
-#endif
-
if (modify)
{
if (type != previous_class_type || current_class_depth > 1)
extern int uses_template_parms PARAMS ((tree));
extern tree instantiate_class_template PARAMS ((tree));
extern tree instantiate_template PARAMS ((tree, tree));
-extern void overload_template_name PARAMS ((tree));
extern int fn_type_unification PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int));
extern tree tinst_for_decl PARAMS ((void));
extern void mark_decl_instantiated PARAMS ((tree, int));
if (TREE_VEC_ELT (t1, 0) == id)
goto skip_it;
+ my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
binding = make_tree_vec (4);
-
- if (id)
- {
- my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
- TREE_VEC_ELT (binding, 0) = id;
- TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
- TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
- TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
- IDENTIFIER_BINDING (id) = NULL_TREE;
- IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
- }
+ TREE_VEC_ELT (binding, 0) = id;
+ TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
+ TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
+ TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
+ IDENTIFIER_BINDING (id) = NULL_TREE;
+ IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
TREE_CHAIN (binding) = old_bindings;
old_bindings = binding;
skip_it:
for (t = s->old_bindings; t; t = TREE_CHAIN (t))
{
tree id = TREE_VEC_ELT (t, 0);
- if (id)
- {
- SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
- IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
- IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
- }
+
+ SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
+ IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
+ IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
}
/* If we were in the middle of compiling a function, restore our
return fndecl;
}
-/* Push the name of the class template into the scope of the instantiation. */
-
-void
-overload_template_name (type)
- tree type;
-{
- tree id = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
- tree decl;
-
- if (IDENTIFIER_CLASS_VALUE (id)
- && TREE_TYPE (IDENTIFIER_CLASS_VALUE (id)) == type)
- return;
-
- decl = build_decl (TYPE_DECL, id, type);
- DECL_ARTIFICIAL (decl) = 1;
- pushdecl_class_level (decl);
-}
-
/* The FN is a TEMPLATE_DECL for a function. The ARGS are the
arguments that are being used when calling it. TARGS is a vector
into which the deduced template arguments are placed.
tree gen_tmpl;
int pattern_defined;
int line = lineno;
+ int need_push;
const char *file = input_filename;
/* This function should only be used to instantiate templates for
goto out;
}
- push_to_top_level ();
+ need_push = !global_bindings_p ();
+ if (need_push)
+ push_to_top_level ();
/* We're now committed to instantiating this template. Mark it as
instantiated so that recursive calls to instantiate_decl do not
/* We're not deferring instantiation any more. */
TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
- pop_from_top_level ();
+ if (need_push)
+ pop_from_top_level ();
out:
lineno = line;