aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/friend.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-27 00:04:40 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-27 00:04:40 -0400
commit866e414678bba1426d1a777eb4a2ae591915b092 (patch)
tree7375a36b894bcab99a69b2597ab44cb65898175b /gcc/cp/friend.c
parent5ac537d7b4983abe5eebe510c798bede816c8165 (diff)
downloadgcc-866e414678bba1426d1a777eb4a2ae591915b092.zip
gcc-866e414678bba1426d1a777eb4a2ae591915b092.tar.gz
gcc-866e414678bba1426d1a777eb4a2ae591915b092.tar.bz2
re PR c++/47721 ([C++0x] Updated friendship rules?)
PR c++/47721 * parser.c (cp_parser_member_declaration): Allow friend T. * friend.c (make_friend_class): Ignore non-classes. * pt.c (instantiate_class_template_1): Handle TEMPLATE_TYPE_PARM. From-SVN: r174319
Diffstat (limited to 'gcc/cp/friend.c')
-rw-r--r--gcc/cp/friend.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index b61611a..36fcca4 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -226,7 +226,14 @@ make_friend_class (tree type, tree friend_type, bool complain)
if (! MAYBE_CLASS_TYPE_P (friend_type))
{
- error ("invalid type %qT declared %<friend%>", friend_type);
+ /* N1791: If the type specifier in a friend declaration designates a
+ (possibly cv-qualified) class type, that class is declared as a
+ friend; otherwise, the friend declaration is ignored.
+
+ So don't complain in C++0x mode. */
+ if (cxx_dialect < cxx0x)
+ pedwarn (input_location, complain ? 0 : OPT_pedantic,
+ "invalid type %qT declared %<friend%>", friend_type);
return;
}