From: Mark Mitchell Date: Fri, 21 Mar 2003 07:04:07 +0000 (+0000) Subject: decl2.c (arg_assoc_class): Correct check for namespace-scope friends. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=963142fcd554cf2ccfab0d85062164fb0da3fb84;p=gcc.git 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 --- 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 + + * 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 * 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 + + * g++.dg/template/friend17.C: New test. + 2003-03-21 Alan Modra * 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 +struct X { + template void operator+=(U); + + template + template + friend void X::operator+=(U); +}; + +int main() { + X() += 1.0; +}