This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] types_compatible_p mess 2/3 (C++)
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 06 Mar 2008 14:36:06 +0100
- Subject: [PATCH] types_compatible_p mess 2/3 (C++)
It seems to me that lang_hooks.types_compatible_p should never be called
with reference types. I tested this with the testcase
extern int printf (const char *, ...);
int f(int &x)
{
printf ("%p", &x);
}
Ok?
Paolo
Index: cp-objcp-common.c
===================================================================
--- cp-objcp-common.c (revision 131960)
+++ cp-objcp-common.c (working copy)
@@ -188,15 +188,6 @@ cxx_types_compatible_p (tree x, tree 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)
- && TYPE_MODE (x) == TYPE_MODE (y)
- && TYPE_REF_CAN_ALIAS_ALL (x) == TYPE_REF_CAN_ALIAS_ALL (y)
- && same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
- return 1;
-
return 0;
}