This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] Fix 11553 (duplicated friend specifier)
- From: Scott Brumbaugh <scottb dot lists at verizon dot net>
- To: Scott Brumbaugh <scottb dot lists at verizon dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 1 Sep 2003 15:49:48 -0700 (PDT)
- Subject: Re: [C++ Patch] Fix 11553 (duplicated friend specifier)
Hi,
Here is another patch for PR 11553 (duplicate friend specifier). I have
reformatted the error function call to conform to the coding standards
after a comment on gcc bugzilla. A test-case is appended to the end of
this file. I have done make bootstrap and make check-g++ on
i686-pc-linux-gnu.
Thanks,
Scott Brumbaugh
2003-09-01 Scott Brumbaugh <scottb.lists@verizon.net>
PR C++/11553
* parser.c (cp_parser_decl_specifier_seq): Add check for a
duplicate friend decl-specifier.
Index: parser.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.105
diff -c -3 -p -r1.105 parser.c
*** parser.c 27 Aug 2003 00:49:19 -0000 1.105
--- parser.c 1 Sep 2003 21:59:22 -0000
*************** cp_parser_decl_specifier_seq (cp_parser*
*** 6305,6311 ****
case RID_FRIEND:
/* decl-specifier:
friend */
! friend_p = true;
/* The representation of the specifier is simply the
appropriate TREE_IDENTIFIER node. */
decl_spec = token->value;
--- 6305,6314 ----
case RID_FRIEND:
/* decl-specifier:
friend */
! if (friend_p)
! error ("duplicate `friend'");
! else
! friend_p = true;
/* The representation of the specifier is simply the
appropriate TREE_IDENTIFIER node. */
decl_spec = token->value;
// { dg-do compile }
//
// PR 11553 catch duplicate friend specifiers
struct S
{
friend friend class C; // { dg-error "duplicate" }
};