diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2002-12-19 15:11:29 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2002-12-19 15:11:29 +0000 |
commit | da9701a61c66e154f085b885f317382e498f451e (patch) | |
tree | 4ea748acd4021885c21b5945f505825263b49d0d /gcc/cp/friend.c | |
parent | cab7a9a3b95c833df6d0175a9a287a9a767879c8 (diff) | |
download | gcc-da9701a61c66e154f085b885f317382e498f451e.zip gcc-da9701a61c66e154f085b885f317382e498f451e.tar.gz gcc-da9701a61c66e154f085b885f317382e498f451e.tar.bz2 |
re PR c++/8099 (Friend classes and template specializations)
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.
From-SVN: r60308
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r-- | gcc/cp/friend.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 9e47411..050862d 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", |