re PR c++/11553 (g++ accepts duplicate 'friend')

PR c++/11553
	* parser.c (cp_parser_decl_specifier_seq): Add check for a
	duplicate friend decl-specifier.

	PR c++/11553
	* g++.dg/parse/friend3.C: New test.

From-SVN: r71008
This commit is contained in:
Scott Brumbaugh 2003-09-02 23:22:10 +00:00 committed by Mark Mitchell
parent 48c2d88a10
commit 1918facfd1
4 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-09-02 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/11553
* parser.c (cp_parser_decl_specifier_seq): Add check for a
duplicate friend decl-specifier.
2003-09-02 Mark Mitchell <mark@codesourcery.com>
PR c++/11847

View File

@ -6312,7 +6312,10 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
case RID_FRIEND:
/* decl-specifier:
friend */
friend_p = true;
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;

View File

@ -1,3 +1,8 @@
2003-09-02 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/11553
* g++.dg/parse/friend3.C: New test.
2003-09-02 Mark Mitchell <mark@codesourcery.com>
PR c++/11847

View File

@ -0,0 +1,10 @@
// { dg-do compile }
//
// PR 11553 catch duplicate friend specifiers
struct S
{
friend friend class C; // { dg-error "duplicate" }
};