re PR c++/32111 (ICE declaring destructor as friend)

gcc/cp/

2007-06-26  Simon Martin  <simartin@users.sourceforge.net>
        
	PR c++/32111
	* decl.c (grokdeclarator): Reset friendp for member functions declared
	friend of their own class.

gcc/testsuite/

2006-06-26  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/32111
	* g++.dg/other/friend5.C: New test.

From-SVN: r126006
This commit is contained in:
Simon Martin 2007-06-25 22:51:12 +00:00 committed by Simon Martin
parent aacfb86b57
commit b46ce77fe8
4 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-06-26 Simon Martin <simartin@users.sourceforge.net>
PR c++/32111
* decl.c (grokdeclarator): Reset friendp for member functions declared
friend of their own class.
2007-06-23 Mark Mitchell <mark@codesourcery.com>
* decl2.c (determine_visibility): Don't look for dllexport here.

View File

@ -8057,7 +8057,10 @@ grokdeclarator (const cp_declarator *declarator,
if (ctype == current_class_type)
{
if (friendp)
pedwarn ("member functions are implicitly friends of their class");
{
pedwarn ("member functions are implicitly friends of their class");
friendp = 0;
}
else
pedwarn ("extra qualification %<%T::%> on member %qs",
ctype, name);

View File

@ -1,3 +1,8 @@
2006-06-26 Simon Martin <simartin@users.sourceforge.net>
PR c++/32111
* g++.dg/other/friend5.C: New test.
2007-06-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32464

View File

@ -0,0 +1,9 @@
/* PR c++/32111 */
/* This used to ICE. */
/* { dg-do "compile" } */
struct A
{
friend A::~A() {} /* { dg-error "implicitly friends of their class" } */
};