]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/32111 (ICE declaring destructor as friend)
authorSimon Martin <simartin@users.sourceforge.net>
Mon, 25 Jun 2007 22:51:12 +0000 (22:51 +0000)
committerSimon Martin <simartin@gcc.gnu.org>
Mon, 25 Jun 2007 22:51:12 +0000 (22:51 +0000)
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

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

index 951faf4af494db9af38935bdc2cd047c11b10eab..6b661bd3df4a595569852d08f6699c82e7885489 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 33f1c2a311a3f1fab8d77db9d2b9a839e21b4120..7d4123fe969b33a8686030a306ae990197c29884 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 eb9251f094c62ea6418f99e7fb3363d0c0202f96..1621e7cfc8843a3f91289d5e40e52178bb45eece 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" } */
+};