pt.c (tsubst_friend_function): Push into namespace of friend function before pushdecl...
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>
Mon, 14 Jun 1999 15:56:12 +0000 (15:56 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Mon, 14 Jun 1999 15:56:12 +0000 (15:56 +0000)
* pt.c (tsubst_friend_function): Push into namespace of friend
function before pushdecl'ing it.

From-SVN: r27520

gcc/cp/ChangeLog
gcc/cp/pt.c

index 18d83d8f15235d7e4073cd07861795d097f6df94..99386f1b1fb0f1797db00e386d25ee134c906199 100644 (file)
@@ -1,3 +1,8 @@
+1999-06-14  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+
+       * pt.c (tsubst_friend_function): Push into namespace of friend
+       function before pushdecl'ing it.
+
 1999-06-14  Nathan Sidwell  <nathan@acm.org>
 
        * call.c (build_new_op): Remove REF_BIND from all operands.
index 2592ab4459854f57a48a8286811db811c86ddfa0..712ad6c963e9441cb7c5e6f4964afd339c71f2e8 100644 (file)
@@ -4495,6 +4495,7 @@ tsubst_friend_function (decl, args)
       tree old_decl;
       tree new_friend_template_info;
       tree new_friend_result_template_info;
+      tree ns;
       int  new_friend_is_defn;
 
       /* We must save some information from NEW_FRIEND before calling
@@ -4517,7 +4518,13 @@ tsubst_friend_function (decl, args)
          new_friend_result_template_info = NULL_TREE;
        }
 
+      /* Inside pushdecl_namespace_level, we will push into the 
+        current namespace. However, the friend function should 
+        tyically go into the namespace of the template. */
+      ns = decl_namespace_context (new_friend);
+      push_nested_namespace (ns);
       old_decl = pushdecl_namespace_level (new_friend);
+      pop_nested_namespace (ns);
 
       if (old_decl != new_friend)
        {