diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-03-21 07:04:07 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-03-21 07:04:07 +0000 |
commit | 963142fcd554cf2ccfab0d85062164fb0da3fb84 (patch) | |
tree | a469b17f94bb3b43828f058644f21f564345c6fe | |
parent | f3cd0185705330987114d311f0c3d9a172c543fb (diff) | |
download | gcc-963142fcd554cf2ccfab0d85062164fb0da3fb84.zip gcc-963142fcd554cf2ccfab0d85062164fb0da3fb84.tar.gz gcc-963142fcd554cf2ccfab0d85062164fb0da3fb84.tar.bz2 |
decl2.c (arg_assoc_class): Correct check for namespace-scope friends.
* 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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/friend17.C | 12 |
5 files changed, 25 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7c26348..9b0eaf1 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 1ba80d7..751d0f6 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 87430b6..8523c96 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 496d9cb..a76454b 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 0000000..50d6024 --- /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; +} |