cp-tree.h (decl_namespace_list): New macro.

* cp-tree.h (decl_namespace_list): New macro.
        (struct saved_scope): Add decl_ns_list.
        * decl.c (mark_saved_scope): Mark it.
        * decl2.c: Lose static decl_namespace_list.
        (init_decl2): Don't save it.

From-SVN: r41316
This commit is contained in:
Jason Merrill 2001-04-12 20:49:43 -04:00 committed by Jason Merrill
parent 3b7da9c5fb
commit ee8fc32b17
5 changed files with 32 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2001-04-12 Jason Merrill <jason_merrill@redhat.com>
* cp-tree.h (decl_namespace_list): New macro.
(struct saved_scope): Add decl_ns_list.
* decl.c (mark_saved_scope): Mark it.
* decl2.c: Lose static decl_namespace_list.
(init_decl2): Don't save it.
2001-04-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-tree.h (warn_return_type, yylex): Delete redundant

View File

@ -776,9 +776,11 @@ extern tree cp_global_trees[CPTI_MAX];
/* Global state. */
struct saved_scope {
struct saved_scope
{
tree old_bindings;
tree old_namespace;
tree decl_ns_list;
tree class_name;
tree class_type;
tree access_specifier;
@ -809,6 +811,10 @@ struct saved_scope {
#define current_namespace scope_chain->old_namespace
/* The stack for namespaces of current declarations. */
#define decl_namespace_list scope_chain->decl_ns_list
/* IDENTIFIER_NODE: name of current class */
#define current_class_name scope_chain->class_name

View File

@ -2422,6 +2422,7 @@ mark_saved_scope (arg)
mark_binding_level (&t->class_bindings);
ggc_mark_tree (t->old_bindings);
ggc_mark_tree (t->old_namespace);
ggc_mark_tree (t->decl_ns_list);
ggc_mark_tree (t->class_name);
ggc_mark_tree (t->class_type);
ggc_mark_tree (t->access_specifier);
@ -5750,7 +5751,7 @@ unqualified_namespace_lookup (name, flags, spacesp)
tree *spacesp;
{
tree b = make_node (CPLUS_BINDING);
tree initial = current_decl_namespace();
tree initial = current_decl_namespace ();
tree scope = initial;
tree siter;
struct binding_level *level;

View File

@ -125,11 +125,6 @@ tree static_dtors;
/* The :: namespace. */
tree global_namespace;
/* The stack for namespaces of current declarations. */
static tree decl_namespace_list;
/* C (and C++) language-specific option variables. */
@ -5365,7 +5360,6 @@ handle_class_head (aggr, scope, id)
void
init_decl2 ()
{
ggc_add_tree_root (&decl_namespace_list, 1);
ggc_add_tree_varray_root (&deferred_fns, 1);
ggc_add_tree_varray_root (&pending_statics, 1);
ggc_add_tree_varray_root (&ssdf_decls, 1);

View File

@ -0,0 +1,15 @@
// Test that pushing into a namespace for a definition doesn't affect
// template instantiations.
// Build don't link:
namespace N {
template <class T> void f () { }
template <class T> struct A { friend void f<T>(); };
};
namespace M {
struct B;
};
struct M::B: public N::A<int> { };