summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-13 22:07:30 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-13 22:07:30 +0000
commit8fc043d8abaade620beadba15647f2977b78a0a6 (patch)
treea3d3d0ff70776f75d1e90655b7d95c53b16ab059 /gcc/cp/pt.c
parentc3fcfd44da367ae283e26a80c247c83278d484c1 (diff)
downloadgcc-8fc043d8abaade620beadba15647f2977b78a0a6.tar.gz
PR c++/65054
* pt.c (template_args_equal): Look through conversions here. * tree.c (cp_tree_equal): Not here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220697 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3317dad35d7..9a00d0d30e6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7324,7 +7324,22 @@ template_args_equal (tree ot, tree nt)
else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot))
return 0;
else
- return cp_tree_equal (ot, nt);
+ {
+ /* Try to treat a template non-type argument that has been converted
+ to the parameter type as equivalent to one that hasn't yet. */
+ for (enum tree_code code1 = TREE_CODE (ot);
+ CONVERT_EXPR_CODE_P (code1)
+ || code1 == NON_LVALUE_EXPR;
+ code1 = TREE_CODE (ot))
+ ot = TREE_OPERAND (ot, 0);
+ for (enum tree_code code2 = TREE_CODE (nt);
+ CONVERT_EXPR_CODE_P (code2)
+ || code2 == NON_LVALUE_EXPR;
+ code2 = TREE_CODE (nt))
+ nt = TREE_OPERAND (nt, 0);
+
+ return cp_tree_equal (ot, nt);
+ }
}
/* Returns 1 iff the OLDARGS and NEWARGS are in fact identical sets of