diff options
author | Jason Merrill <jason@redhat.com> | 2001-04-12 20:49:43 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2001-04-12 20:49:43 -0400 |
commit | ee8fc32b175c476e21656b7a30d0768464d4cff9 (patch) | |
tree | 9c856bf58377189463c069a4824daf090ac8b39a /gcc | |
parent | 3b7da9c5fbf3490b5a02925eebd96ddc1d394a6d (diff) | |
download | gcc-ee8fc32b175c476e21656b7a30d0768464d4cff9.zip gcc-ee8fc32b175c476e21656b7a30d0768464d4cff9.tar.gz gcc-ee8fc32b175c476e21656b7a30d0768464d4cff9.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ns/template16.C | 15 |
5 files changed, 32 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8a00437..0ae306f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8e8574d..b1d3ee4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ac9f058..fb6b8a3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d49df73..f8524cb 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template16.C b/gcc/testsuite/g++.old-deja/g++.ns/template16.C new file mode 100644 index 0000000..760be46 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template16.C @@ -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> { }; |