aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc/objc-act.c
diff options
context:
space:
mode:
authorAlexander Malmberg <alexander@malmberg.org>2005-01-25 03:13:10 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-01-24 19:13:10 -0800
commit3f16185feb0636509d9f865e624c4c3712273cc4 (patch)
tree38df44a09f1d032b7868951f4c41192154178ce9 /gcc/objc/objc-act.c
parenta6d2976a97625bea66e80fb63384a68ab79983ae (diff)
downloadgcc-3f16185feb0636509d9f865e624c4c3712273cc4.zip
gcc-3f16185feb0636509d9f865e624c4c3712273cc4.tar.gz
gcc-3f16185feb0636509d9f865e624c4c3712273cc4.tar.bz2
re PR objc/18408 (ICE compiling code that involves casting classes)
2005-01-25 Alexander Malmberg <alexander@malmberg.org> PR objc/18408 * objc-act.c (objc_types_compatible_p): New function. * objc-act.h (objc_types_compatible_p): Declare. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define. From-SVN: r94199
Diffstat (limited to 'gcc/objc/objc-act.c')
-rw-r--r--gcc/objc/objc-act.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 65af654..fff747b 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -73,6 +73,7 @@ Boston, MA 02111-1307, USA. */
#include "tree-iterator.h"
#include "libfuncs.h"
#include "hashtab.h"
+#include "langhooks-def.h"
#define OBJC_VOID_AT_END void_list_node
@@ -836,6 +837,27 @@ objc_is_class_id (tree type)
return OBJC_TYPE_NAME (type) == objc_class_id;
}
+
+int
+objc_types_compatible_p (tree type1, tree type2)
+{
+
+ if (objc_is_object_ptr (type1) || objc_is_object_ptr (type2)
+ || objc_is_class_name (type1) || objc_is_class_name (type2))
+ {
+ return lhd_types_compatible_p (type1, type2);
+ }
+ else
+ {
+#ifdef OBJCPLUS
+ return cxx_types_compatible_p (type1, type2);
+#else
+ return c_types_compatible_p (type1, type2);
+#endif
+ }
+}
+
+
/* Return 1 if LHS and RHS are compatible types for assignment or
various other operations. Return 0 if they are incompatible, and
return -1 if we choose to not decide (because the types are really