aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7025deff788..089a57d7d27 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -34,7 +34,11 @@ Boston, MA 02111-1307, USA. */
#include "tree.h"
#include "pointer-set.h"
#include "flags.h"
+/* APPLE LOCAL Objective-C++ */
+#include "c-common.h"
#include "cp-tree.h"
+/* APPLE LOCAL Objective-C++ */
+#include "cp-objcp-common.h"
#include "tree-inline.h"
#include "decl.h"
#include "output.h"
@@ -4012,7 +4016,26 @@ template_args_equal (tree ot, tree nt)
/* For member templates */
return TREE_CODE (ot) == TREE_VEC && comp_template_args (ot, nt);
else if (TYPE_P (nt))
- return TYPE_P (ot) && same_type_p (ot, nt);
+ /* APPLE LOCAL begin Objective-C++ */
+ {
+ int c1, c2;
+
+ if (!TYPE_P (ot))
+ return 0;
+
+ /* We must handle ObjC types specially because they may differ
+ only in protocol qualifications (e.g., 'NSObject *' vs.
+ 'NSObject <Foo> *') that must be taken into account here.
+ See also cp/typeck.c:build_c_cast(), where a similar problem
+ arises. We must call objc_comptypes() twice, since its
+ comparisons are _not_ symmetric. */
+ if ((c1 = objc_comptypes (ot, nt, 0)) >= 0
+ && (c2 = objc_comptypes (nt, ot, 0)) >= 0)
+ return (c1 && c2);
+
+ return same_type_p (ot, nt);
+ }
+ /* APPLE LOCAL end Objective-C++ */
else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot))
return 0;
else
@@ -8839,6 +8862,18 @@ tsubst_copy_and_build (tree t,
return t;
default:
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Handle Objective-C++ constructs, if appropriate. */
+ {
+ tree subst
+ = objcp_tsubst_copy_and_build (t, args, complain,
+ in_decl, /*function_p=*/false);
+
+ if (subst)
+ return subst;
+ }
+ /* APPLE LOCAL end Objective-C++ */
+
return tsubst_copy (t, args, complain, in_decl);
}