This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR C++/13558
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Sun, 4 Jan 2004 03:05:25 -0500
- Subject: [PATCH] Fix PR C++/13558
When the new parser went in, it changed what tree went into a TYPE_DECL
which causes IS_AGGR_TYPE to ICE because it is expecting a type so this
patch fixes that.
I have not tried to get rid of if containing IS_AGGR_TYPE yet.
Okay? bootstrapped on powerpc-apple-darwin7.2.0 with no regressions.
ChangeLog:
* friend.c (make_friend_class): Check if friend_type is a decl
and error out if it is.
Patch:
Index: friend.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/friend.c,v
retrieving revision 1.93
diff -u -p -r1.93 friend.c
--- friend.c 19 Dec 2003 23:28:06 -0000 1.93
+++ friend.c 4 Jan 2004 04:39:30 -0000
@@ -197,6 +197,13 @@ make_friend_class (tree type, tree frien
tree classes;
int is_template_friend;
+ if (DECL_P (friend_type))
+ {
+ error ("invalid type `%T' declared `friend'", TREE_TYPE
+ (friend_type));
+ return;
+ }
+
if (! IS_AGGR_TYPE (friend_type))
{
error ("invalid type `%T' declared `friend'", friend_type);