diff options
Diffstat (limited to 'gcc/cp/pt.c')
| -rw-r--r-- | gcc/cp/pt.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9006ab9..f5e3f8a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -34,7 +34,9 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "pointer-set.h" #include "flags.h" +#include "c-common.h" #include "cp-tree.h" +#include "cp-objcp-common.h" #include "tree-inline.h" #include "decl.h" #include "output.h" @@ -4024,7 +4026,24 @@ 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); + { + 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); + } else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot)) return 0; else @@ -8880,6 +8899,14 @@ tsubst_copy_and_build (tree t, return t; default: + /* 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; + } return tsubst_copy (t, args, complain, in_decl); } |
