decl2.c (arg_assoc_class): Correct check for namespace-scope friends.
authorMark Mitchell <mark@codesourcery.com>
Fri, 21 Mar 2003 07:04:07 +0000 (07:04 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 21 Mar 2003 07:04:07 +0000 (07:04 +0000)
* cp/decl2.c (arg_assoc_class): Correct check for namespace-scope
friends.
* cp/pt.c (instantiate_class_template): Fix formatting.

* g++.dg/template/friend17.C: New test.

From-SVN: r64645

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend17.C [new file with mode: 0644]

index 7c263488cbbf1b0f5fbb5773ddde9b9ef7165cda..9b0eaf1b39ce1b749bf9058a21a8e977efb029aa 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-20  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp/decl2.c (arg_assoc_class): Correct check for namespace-scope
+       friends.
+       * cp/pt.c (instantiate_class_template): Fix formatting.
+
 2003-03-14  Matt Austern  <austern@apple.com>
 
        * cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.
index 1ba80d7a7d8130cbaee4cf026cc71b38d522cdd0..751d0f6534f9c529cac410e4dc920d71cc0f524d 100644 (file)
@@ -3963,7 +3963,7 @@ arg_assoc_class (struct arg_lookup *k, tree type)
           friends = TREE_CHAIN (friends))
        /* Only interested in global functions with potentially hidden
            (i.e. unqualified) declarations.  */
-       if (decl_namespace (TREE_VALUE (friends)) == context)
+       if (CP_DECL_CONTEXT (TREE_VALUE (friends)) == context)
          if (add_function (k, TREE_VALUE (friends)))
            return true;
 
index 87430b67ffbc757821a33ac64a888b897f68ac15..8523c9671cc180735d6b91818065b8f9a6105bec 100644 (file)
@@ -5548,12 +5548,8 @@ instantiate_class_template (type)
                --processing_template_decl;
            }
          else
-           {
-             /* Build new DECL_FRIENDLIST.  */
-
-             add_friend (type, 
-                         tsubst_friend_function (t, args));
-           }
+           /* Build new DECL_FRIENDLIST.  */
+           add_friend (type, tsubst_friend_function (t, args));
        }
     }
 
index 496d9cb3b1297572db2bdcaa90047fe9c1ca290f..a76454bb1c3186d63e2a8787ec196466366f8a27 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-20  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/template/friend17.C: New test.
+
 2003-03-21  Alan Modra  <amodra@bigpond.net.au>
 
        * gcc.c-torture/compile/20030320-1.c: New.
diff --git a/gcc/testsuite/g++.dg/template/friend17.C b/gcc/testsuite/g++.dg/template/friend17.C
new file mode 100644 (file)
index 0000000..50d6024
--- /dev/null
@@ -0,0 +1,12 @@
+template <class T>
+struct X {
+  template <class U> void operator+=(U);
+  
+  template <class V>
+  template <class U>
+  friend void X<V>::operator+=(U);
+};
+
+int main() {   
+  X<int>() += 1.0;
+}