Commit 2befd3f7 by Jason Merrill Committed by Jason Merrill

Fix constraint satisfaction in uninstantiated template.

	* constraint.cc (constraints_satisfied_p): Keep as many levels of
	args as our template has levels of parms.

From-SVN: r237655
parent e547455b
2016-06-21 Jason Merrill <jason@redhat.com> 2016-06-21 Jason Merrill <jason@redhat.com>
* constraint.cc (constraints_satisfied_p): Keep as many levels of
args as our template has levels of parms.
* pt.c (template_parm_outer_level, uses_outer_template_parms): New. * pt.c (template_parm_outer_level, uses_outer_template_parms): New.
(type_dependent_expression_p): Use uses_outer_template_parms. (type_dependent_expression_p): Use uses_outer_template_parms.
......
...@@ -2122,8 +2122,10 @@ constraints_satisfied_p (tree decl) ...@@ -2122,8 +2122,10 @@ constraints_satisfied_p (tree decl)
tree args = NULL_TREE; tree args = NULL_TREE;
if (tree ti = DECL_TEMPLATE_INFO (decl)) if (tree ti = DECL_TEMPLATE_INFO (decl))
{ {
ci = get_constraints (TI_TEMPLATE (ti)); tree tmpl = TI_TEMPLATE (ti);
args = INNERMOST_TEMPLATE_ARGS (TI_ARGS (ti)); ci = get_constraints (tmpl);
int depth = TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl));
args = get_innermost_template_args (TI_ARGS (ti), depth);
} }
else else
{ {
......
// { dg-options "-std=c++1z -fconcepts" }
template <class T>
struct A {
template <class U>
requires sizeof(T) == 1
static void f(U);
template <class U>
requires sizeof(T) == 2
static void f(U);
void g()
{
f(42);
}
};
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