aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2004-07-16 13:11:06 -0400
committerJason Merrill <jason@gcc.gnu.org>2004-07-16 13:11:06 -0400
commit27f1984e92ee9b231b755d224f8035fe8fc97596 (patch)
treee387efecd2bb3f8000354d5a9b552e1c4c83bd00 /gcc/cp
parenta23ee064e26afca80e24ccc9036ef01f54b1f377 (diff)
downloadgcc-27f1984e92ee9b231b755d224f8035fe8fc97596.zip
gcc-27f1984e92ee9b231b755d224f8035fe8fc97596.tar.gz
gcc-27f1984e92ee9b231b755d224f8035fe8fc97596.tar.bz2
undo reversion
From-SVN: r84822
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-lang.c16
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 189ff97..f34b38e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -60,6 +60,11 @@
(add_conversions): Likewise.
* semantics.c (finish_member_declaration): Adjust call to add_method.
+2004-07-15 Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (cxx_types_compatible_p): To the middle-end,
+ references and pointers are compatible.
+
2004-07-15 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (xref_basetypes): Refactor.
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 5f38fbb..b6e933f 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -317,9 +317,23 @@ cp_var_mod_type_p (tree type, tree fn)
return false;
}
+/* This compares two types for equivalence ("compatible" in C-based languages).
+ This routine should only return 1 if it is sure. It should not be used
+ in contexts where erroneously returning 0 causes problems. */
+
static int cxx_types_compatible_p (tree x, tree y)
{
- return same_type_ignoring_top_level_qualifiers_p (x, y);
+ if (same_type_ignoring_top_level_qualifiers_p (x, y))
+ return 1;
+
+ /* Once we get to the middle-end, references and pointers are
+ interchangeable. FIXME should we try to replace all references with
+ pointers? */
+ if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y)
+ && same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
+ return 1;
+
+ return 0;
}
/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed