summaryrefslogtreecommitdiffstats
path: root/gcc/cp/cp-lang.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-16 17:11:06 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-16 17:11:06 +0000
commit975582444fffc1bb0686ebb3ae5062a2faddf75e (patch)
treee387efecd2bb3f8000354d5a9b552e1c4c83bd00 /gcc/cp/cp-lang.c
parent821fa04597c85a989208417116a579a8333810cc (diff)
downloadppe42-gcc-975582444fffc1bb0686ebb3ae5062a2faddf75e.tar.gz
ppe42-gcc-975582444fffc1bb0686ebb3ae5062a2faddf75e.zip
undo reversion
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84822 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cp-lang.c')
-rw-r--r--gcc/cp/cp-lang.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 5f38fbb1025..b6e933fede6 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
OpenPOWER on IntegriCloud