summaryrefslogtreecommitdiff
path: root/gcc/cp/friend.c
diff options
context:
space:
mode:
authorlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-19 15:11:29 +0000
committerlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-19 15:11:29 +0000
commitcb96e388beb2e436f5eee1d569a68170a140e517 (patch)
tree4ea748acd4021885c21b5945f505825263b49d0d /gcc/cp/friend.c
parent0246130d5e09f0ecbe1be76c84444f22090ea387 (diff)
downloadgcc-cb96e388beb2e436f5eee1d569a68170a140e517.tar.gz
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
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r--gcc/cp/friend.c29
1 files changed, 15 insertions, 14 deletions
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",