summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/tree.c18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/nontype4.C31
3 files changed, 50 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0bf7d8a1247..b54b78fadd5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,7 @@
1998-05-24 Mark Mitchell <mark@markmitchell.com>
+ * tree.c (cp_tree_equal): Handle pointers to member functions.
+
* call.c (maybe_handle_implicit_object): Handle QUAL_CONVs. Make
sure the type of the REF_BIND is a reference type.
(maybe_handle_ref_bind, compare_ics): Rename reference_type to
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index ce601184d23..a5f30eaa851 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2134,7 +2134,23 @@ cp_tree_equal (t1, t2)
TREE_STRING_LENGTH (t1));
case CONSTRUCTOR:
- abort ();
+ /* We need to do this when determining whether or not two
+ non-type pointer to member function template arguments
+ are the same. */
+ if (!(comptypes (TREE_TYPE (t1), TREE_TYPE (t2), 1)
+ /* The first operand is RTL. */
+ && TREE_OPERAND (t1, 0) == TREE_OPERAND (t2, 0)))
+ return 0;
+ return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
+
+ case TREE_LIST:
+ cmp = cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2));
+ if (cmp <= 0)
+ return cmp;
+ cmp = cp_tree_equal (TREE_VALUE (t1), TREE_VALUE (t2));
+ if (cmp <= 0)
+ return cmp;
+ return cp_tree_equal (TREE_CHAIN (t1), TREE_CHAIN (t2));
case SAVE_EXPR:
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/nontype4.C b/gcc/testsuite/g++.old-deja/g++.pt/nontype4.C
new file mode 100644
index 00000000000..2aa38b1cd67
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/nontype4.C
@@ -0,0 +1,31 @@
+// Build don't link:
+
+template <class R, void (R::* A) (void)>
+class s
+{
+public:
+ s (R &r) : _r (r) {}
+
+ void e (void) { (_r.*A) (); }
+
+private:
+ R &_r;
+};
+
+class x
+{
+public:
+ void test1 (void) { int j = 0; }
+ void test2 (void) { int j = 1; }
+};
+
+int
+main (void)
+{
+ x r;
+
+ s<x, &x::test1> c4 (r);
+ s<x, &x::test2> c5 (r);
+
+ return 0;
+}
OpenPOWER on IntegriCloud