aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-10-12 09:06:32 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-10-12 09:06:32 +0000
commite60505a59dad6aa8c17c43411e4998b209ddcd64 (patch)
treee3c3c2dd24d4141001d42a1257179ad8d2814bbc
parenta77776205c58c490df1e24c406a57be963ffd815 (diff)
downloadgcc-e60505a59dad6aa8c17c43411e4998b209ddcd64.zip
gcc-e60505a59dad6aa8c17c43411e4998b209ddcd64.tar.gz
gcc-e60505a59dad6aa8c17c43411e4998b209ddcd64.tar.bz2
re PR c++/4476 (g++ does not parse the definition of friend function within a class properly)
cp: PR g++/4476 * typeck2.c (abstract_virtuals_error): Ignore incomplete classes. testsuite: PR g++/4476 * g++.dg/other/friend1.C: New test. From-SVN: r46226
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/friend1.C12
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4c4cdce..50af839 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/4476
+ * typeck2.c (abstract_virtuals_error): Ignore incomplete classes.
+
2001-10-11 Jason Merrill <jason_merrill@redhat.com>
* typeck2.c (store_init_value): Don't re-digest a bracketed
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index fbedc13..2a9b2a9 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -140,6 +140,11 @@ abstract_virtuals_error (decl, type)
if (!CLASS_TYPE_P (type) || !CLASSTYPE_PURE_VIRTUALS (type))
return 0;
+ if (!TYPE_SIZE (type))
+ /* TYPE is being defined, and during that time
+ CLASSTYPE_PURE_VIRTUALS holds the inline friends. */
+ return 0;
+
u = CLASSTYPE_PURE_VIRTUALS (type);
if (decl)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d7fd68e..2a50b83 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/4476
+ * g++.dg/other/friend1.C: New test.
+
2001-10-11 Richard Henderson <rth@redhat.com>
* g++.old-deja/g++.other/crash18.C: Add -S to options.
diff --git a/gcc/testsuite/g++.dg/other/friend1.C b/gcc/testsuite/g++.dg/other/friend1.C
new file mode 100644
index 0000000..3193180
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/friend1.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 10 Oct 2001 <nathan@codesourcery.com>
+
+// Bug 4476. We tangled up inline friends and pure virtuals during
+// class definition.
+
+struct A {
+ friend void f () { }
+ void g (A a) { }
+};