Commit 5c161741 by Jason Merrill

c++: Fix template parm with dependent type in concepts.

While looking at PR94186 I also noticed this regression; if a non-type
template parameter uses a type parameter in its type, we need to map both
template parameters.

gcc/cp/ChangeLog
2020-03-24  Jason Merrill  <jason@redhat.com>

	* pt.c (any_template_parm_r): Look into the type of a non-type
	template parm.
parent 6e771c08
2020-03-24 Jason Merrill <jason@redhat.com> 2020-03-24 Jason Merrill <jason@redhat.com>
* pt.c (any_template_parm_r): Look into the type of a non-type
template parm.
2020-03-24 Jason Merrill <jason@redhat.com>
* cp-tree.h (cp_expr): When constructing from an expr and a * cp-tree.h (cp_expr): When constructing from an expr and a
location, call protected_set_expr_location. location, call protected_set_expr_location.
......
...@@ -10431,6 +10431,7 @@ any_template_parm_r (tree t, void *data) ...@@ -10431,6 +10431,7 @@ any_template_parm_r (tree t, void *data)
WALK_SUBTREE (TREE_OPERAND (t, 1)); WALK_SUBTREE (TREE_OPERAND (t, 1));
break; break;
case TEMPLATE_PARM_INDEX:
case PARM_DECL: case PARM_DECL:
/* A parameter or constraint variable may also depend on a template /* A parameter or constraint variable may also depend on a template
parameter without explicitly naming it. */ parameter without explicitly naming it. */
......
// { dg-do compile { target concepts } }
template<class X, X x>
concept C = requires {
requires x; // { dg-error "bool" }
};
int main() {
C<int, 0>;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment