aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-04-23 09:34:57 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-04-23 05:34:57 -0400
commitbec17cf31e9094ea1e015d8cf5fca2583a4161a8 (patch)
treeb5d110300a90fa737f587e7e011fb840ac40b3f4
parent04a81d94f44365d400f18f2973fd95856351c681 (diff)
downloadgcc-bec17cf31e9094ea1e015d8cf5fca2583a4161a8.zip
gcc-bec17cf31e9094ea1e015d8cf5fca2583a4161a8.tar.gz
gcc-bec17cf31e9094ea1e015d8cf5fca2583a4161a8.tar.bz2
* typeck.c (comp_target_types): Fix PMFs.
From-SVN: r19383
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c44
2 files changed, 44 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 949da95..c6025df 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+Thu Apr 23 09:32:58 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (comp_target_types): Fix PMFs.
+
Wed Apr 22 13:24:48 1998 Mark Mitchell <mmitchell@usa.net>
* class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index f891b1e..c0b00b0 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -959,6 +959,9 @@ comp_target_types (ttl, ttr, nptrs)
return comp_array_types (comp_target_types, ttl, ttr, 0);
else if (TREE_CODE (ttr) == FUNCTION_TYPE || TREE_CODE (ttr) == METHOD_TYPE)
{
+ tree argsl, argsr;
+ int saw_contra = 0;
+
if (pedantic)
{
if (comptypes (TREE_TYPE (ttl), TREE_TYPE (ttr), 1) == 0)
@@ -966,12 +969,45 @@ comp_target_types (ttl, ttr, nptrs)
}
else
{
- if (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), -1) == 0)
- return 0;
+ switch (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), -1))
+ {
+ case 0:
+ return 0;
+ case -1:
+ saw_contra = 1;
+ }
}
- return comp_target_parms (TYPE_ARG_TYPES (ttl),
- TYPE_ARG_TYPES (ttr), 1);
+ argsl = TYPE_ARG_TYPES (ttl);
+ argsr = TYPE_ARG_TYPES (ttr);
+
+ /* Compare 'this' here, not in comp_target_parms. */
+ if (TREE_CODE (ttr) == METHOD_TYPE)
+ {
+ tree tl = TYPE_METHOD_BASETYPE (ttl);
+ tree tr = TYPE_METHOD_BASETYPE (ttr);
+
+ if (comptypes (tr, tl, 0) == 0)
+ {
+ if (comptypes (tl, tr, 0))
+ saw_contra = 1;
+ else
+ return 0;
+ }
+
+ argsl = TREE_CHAIN (argsl);
+ argsr = TREE_CHAIN (argsr);
+ }
+
+ switch (comp_target_parms (argsl, argsr, 1))
+ {
+ case 0:
+ return 0;
+ case -1:
+ saw_contra = 1;
+ }
+
+ return saw_contra ? -1 : 1;
}
/* for C++ */
else if (TREE_CODE (ttr) == OFFSET_TYPE)