From cb96e388beb2e436f5eee1d569a68170a140e517 Mon Sep 17 00:00:00 2001 From: lerdsuwa Date: Thu, 19 Dec 2002 15:11:29 +0000 Subject: PR c++/8099 * friend.c (make_friend_class): Allow partial specialization when declaration is not a template friend. * g++.dg/template/friend9.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60308 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/friend.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'gcc/cp/friend.c') diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 9e474114312..050862d0151 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -205,24 +205,25 @@ make_friend_class (type, friend_type) return; } - if (CLASS_TYPE_P (friend_type) - && CLASSTYPE_TEMPLATE_SPECIALIZATION (friend_type) - && uses_template_parms (friend_type)) - { - /* [temp.friend] - - Friend declarations shall not declare partial - specializations. */ - error ("partial specialization `%T' declared `friend'", - friend_type); - return; - } - if (processing_template_decl > template_class_depth (type)) /* If the TYPE is a template then it makes sense for it to be friends with itself; this means that each instantiation is friends with all other instantiations. */ - is_template_friend = 1; + { + if (CLASS_TYPE_P (friend_type) + && CLASSTYPE_TEMPLATE_SPECIALIZATION (friend_type) + && uses_template_parms (friend_type)) + { + /* [temp.friend] + Friend declarations shall not declare partial + specializations. */ + error ("partial specialization `%T' declared `friend'", + friend_type); + return; + } + + is_template_friend = 1; + } else if (same_type_p (type, friend_type)) { pedwarn ("class `%T' is implicitly friends with itself", -- cgit v1.2.1