OSDN Git Service

gcc/cp/
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Jun 2007 22:51:12 +0000 (22:51 +0000)
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Jun 2007 22:51:12 +0000 (22:51 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126006 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/friend5.C [new file with mode: 0644]

index 951faf4..6b661bd 100644 (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.
index 33f1c2a..7d4123f 100644 (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);
index eb9251f..1621e7c 100644 (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
diff --git a/gcc/testsuite/g++.dg/other/friend5.C b/gcc/testsuite/g++.dg/other/friend5.C
new file mode 100644 (file)
index 0000000..45bbf27
--- /dev/null
@@ -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" } */
+};