From: Ziemowit Laski Date: Fri, 10 Sep 2004 06:40:15 +0000 (+0000) Subject: typeck.c (build_c_cast): Preserve the cast if casting to and from an Objective-C... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e2da46727a4b1414d5f2f8d2a016a8609268abe;p=gcc.git typeck.c (build_c_cast): Preserve the cast if casting to and from an Objective-C type. [gcc/cp/ChangeLog] 2004-09-09 Ziemowit Laski * typeck.c (build_c_cast): Preserve the cast if casting to and from an Objective-C type. From-SVN: r87277 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 43c58aa5ed0..08b32a26a65 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-09-09 Ziemowit Laski + + * typeck.c (build_c_cast): Preserve the cast if casting + to and from an Objective-C type. + 2004-09-09 Ziemowit Laski * Make-lang.in (cp/typeck.o): Depend on c-common.h. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 94e903db1c8..f4d1679557a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4829,6 +4829,13 @@ build_c_cast (tree type, tree expr) 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