* 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
+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
/* 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;
#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
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);
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;
/* The :: namespace. */
tree global_namespace;
-
-/* The stack for namespaces of current declarations. */
-
-static tree decl_namespace_list;
-
\f
/* C (and C++) language-specific option variables. */
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);
--- /dev/null
+// 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> { };