This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;
 }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]