[gcc/cp/ChangeLog]
2004-09-09 Ziemowit Laski <zlaski@apple.com>
* typeck.c (build_c_cast): Preserve the cast if casting
to and from an Objective-C type.
From-SVN: r87277
+2004-09-09 Ziemowit Laski <zlaski@apple.com>
+
+ * typeck.c (build_c_cast): Preserve the cast if casting
+ to and from an Objective-C type.
+
2004-09-09 Ziemowit Laski <zlaski@apple.com>
* Make-lang.in (cp/typeck.o): Depend on c-common.h.
return t;
}
+ /* Casts to a (pointer to a) specific ObjC class (or 'id' or
+ 'Class') should always be retained, because this information aids
+ in method lookup. */
+ if (objc_is_object_ptr (type)
+ && objc_is_object_ptr (TREE_TYPE (expr)))
+ return build_nop (type, expr);
+
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
if (TREE_CODE (type) != REFERENCE_TYPE