This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PCH merge C++ breakage
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 24 Jul 2002 14:44:22 -0700
- Subject: Re: PCH merge C++ breakage
- References: <wvl3cu99kzy.fsf@prospero.cambridge.redhat.com>
Jason Merrill <jason@redhat.com> writes:
> because now TYPE_GET_PTRMEMFUNC_TYPE is the same for all cv-variants.
I'll commit this patch to fix the problem when it finishes a bootstrap
on x86-linux:
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.2893
diff -p -u -p -r1.2893 ChangeLog
--- cp/ChangeLog 23 Jul 2002 21:58:57 -0000 1.2893
+++ cp/ChangeLog 24 Jul 2002 21:42:22 -0000
@@ -1,3 +1,9 @@
+2002-07-24 Geoffrey Keating <geoffk@redhat.com>
+
+ * tree.c (cp_build_qualified_type_real): When copying
+ pointer-to-method types, unshare the record that holds
+ the cached pointer-to-member-function type.
+
2002-07-23 Neil Booth <neil@daikokuya.co.uk>
* cp-tree.h (FILE_FUNCTION_PREFIX_LEN): Remove.
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.289
diff -p -u -p -r1.289 tree.c
--- cp/tree.c 11 Jul 2002 21:12:47 -0000 1.289
+++ cp/tree.c 24 Jul 2002 21:42:22 -0000
@@ -644,13 +644,13 @@ cp_build_qualified_type_real (type, type
result = build_qualified_type (type, type_quals);
/* If this was a pointer-to-method type, and we just made a copy,
- then we need to clear the cached associated
- pointer-to-member-function type; it is not valid for the new
- type. */
+ then we need to unshare the record that holds the cached
+ pointer-to-member-function type, because these will be distinct
+ between the unqualified and qualified types. */
if (result != type
&& TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
- TYPE_SET_PTRMEMFUNC_TYPE (result, NULL_TREE);
+ TYPE_LANG_SPECIFIC (result) = NULL;
return result;
}
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.2000
diff -p -u -p -r1.2000 ChangeLog
--- testsuite/ChangeLog 24 Jul 2002 14:12:50 -0000 1.2000
+++ testsuite/ChangeLog 24 Jul 2002 21:42:24 -0000
@@ -1,3 +1,7 @@
+2002-07-24 Geoffrey Keating <geoffk@redhat.com>
+
+ * g++.dg/other/ptrmem4.C: New testcase.
+
2002-07-24 Gabriel Dos Reis <gdr@nerim.net>
* g++.dg/ext/alignof1.C (main): Return 0 for success.
Index: testsuite/g++.dg/other/ptrmem4.C
===================================================================
RCS file: testsuite/g++.dg/other/ptrmem4.C
diff -N testsuite/g++.dg/other/ptrmem4.C
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/other/ptrmem4.C 24 Jul 2002 21:42:24 -0000
@@ -0,0 +1,18 @@
+// Bug: This checks that the pointer-to-member-function type is not
+// shared between differently-qualified pointer-to-method types.
+
+// { dg-do compile }
+struct A
+{
+ void f () {}
+};
+
+void (A::*const cp)() = &A::f;
+
+int main ()
+{
+ void (A::* p)();
+ void (A::** ip)() = &p;
+
+ *ip = &A::f;
+}
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>