aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@redhat.com>2002-07-24 23:01:07 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2002-07-24 23:01:07 +0000
commit3cfab7ec187a78d27d5625fa8472897dc923617b (patch)
tree6463dfec266ba39f4994dd525a32dbb69233c8a6
parenteb5da24bed4710f5c1fa9be221d22ddbeb44f583 (diff)
downloadgcc-3cfab7ec187a78d27d5625fa8472897dc923617b.zip
gcc-3cfab7ec187a78d27d5625fa8472897dc923617b.tar.gz
gcc-3cfab7ec187a78d27d5625fa8472897dc923617b.tar.bz2
In cp/ChangeLog:
* 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. In testsuite/ChangeLog: * g++.dg/other/ptrmem4.C: New testcase. From-SVN: r55725
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/ptrmem4.C18
4 files changed, 32 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ba8093f..659ecfa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index b6e70ce..ea456f0 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -644,13 +644,13 @@ cp_build_qualified_type_real (type, type_quals, complain)
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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ee83e8..90da516 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-24 Geoffrey Keating <geoffk@redhat.com>
+
+ * g++.dg/other/ptrmem4.C: New testcase.
+
2002-07-24 Richard Henderson <rth@redhat.com>
* gcc.c-torture/execute/loop-2e.c: Rewrite for 64 bit and no mmap.
diff --git a/gcc/testsuite/g++.dg/other/ptrmem4.C b/gcc/testsuite/g++.dg/other/ptrmem4.C
new file mode 100644
index 0000000..4f3f541
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/ptrmem4.C
@@ -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;
+}