summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-21 07:04:07 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-21 07:04:07 +0000
commitf5083c1bb992083bd438841be220b94c3b35ad1f (patch)
treea469b17f94bb3b43828f058644f21f564345c6fe
parent9e1f4e74bb657bdc619a75c35904613520cbd3db (diff)
downloadppe42-gcc-f5083c1bb992083bd438841be220b94c3b35ad1f.tar.gz
ppe42-gcc-f5083c1bb992083bd438841be220b94c3b35ad1f.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64645 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/template/friend17.C12
5 files changed, 25 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7c263488cbb..9b0eaf1b39c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 1ba80d7a7d8..751d0f6534f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 87430b67ffb..8523c9671cc 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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));
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 496d9cb3b12..a76454bb1c3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..50d60244150
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend17.C
@@ -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;
+}
OpenPOWER on IntegriCloud