aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constraint.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-01-13 17:38:19 -0500
committerJason Merrill <jason@redhat.com>2020-01-13 20:30:18 -0500
commit8ca4435f431f9b8049ebf102b5659f2d3e7be198 (patch)
tree577caca36cad64bb399b2dd2efec17d348921b36 /gcc/cp/constraint.cc
parentf1ba88b1b20cb579b3b7ce6ce65470205742be7e (diff)
downloadgcc-8ca4435f431f9b8049ebf102b5659f2d3e7be198.zip
gcc-8ca4435f431f9b8049ebf102b5659f2d3e7be198.tar.gz
gcc-8ca4435f431f9b8049ebf102b5659f2d3e7be198.tar.bz2
PR c++/92582 - ICE with member template as requirement.
Here, we weren't recognizing that the template parameter of A is used by the reference to d in the requires-clause of f. Fixed by passing down the active template parameters in the context of normalization, and adding to the mapping any such parameters shared by a member template used in the constraint-expression. * pt.c (struct find_template_parameter_info): Add ctx_parms. (any_template_parm_r): Handle TEMPLATE_DECL. (find_template_parameters): Take parms instead of their depth. * constraint.cc (build_parameter_mapping): Pass them.
Diffstat (limited to 'gcc/cp/constraint.cc')
-rw-r--r--gcc/cp/constraint.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 11f5807..128ab8a 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -559,12 +559,11 @@ map_arguments (tree parms, tree args)
static tree
build_parameter_mapping (tree expr, tree args, tree decl)
{
- int depth = 0;
+ tree ctx_parms = NULL_TREE;
if (decl)
{
gcc_assert (TREE_CODE (decl) == TEMPLATE_DECL);
- tree parms = DECL_TEMPLATE_PARMS (decl);
- depth = TREE_INT_CST_LOW (TREE_PURPOSE (parms));
+ ctx_parms = DECL_TEMPLATE_PARMS (decl);
}
else if (current_template_parms)
{
@@ -572,10 +571,10 @@ build_parameter_mapping (tree expr, tree args, tree decl)
point of declaration of concepts is currently set after the
initializer, the template parameter lists are not available
when normalizing concept definitions, hence the case above. */
- depth = TMPL_PARMS_DEPTH (current_template_parms);
+ ctx_parms = current_template_parms;
}
- tree parms = find_template_parameters (expr, depth);
+ tree parms = find_template_parameters (expr, ctx_parms);
tree map = map_arguments (parms, args);
return map;
}