aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c54
1 files changed, 11 insertions, 43 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 4ed424f..d36564d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -717,24 +717,12 @@ inherited_ctor_rejection (void)
return r;
}
-// Build a constraint failure record, saving information into the
-// template_instantiation field of the rejection. If FN is not a template
-// declaration, the TMPL member is the FN declaration and TARGS is empty.
+/* Build a constraint failure record. */
static struct rejection_reason *
-constraint_failure (tree fn)
+constraint_failure (void)
{
struct rejection_reason *r = alloc_rejection (rr_constraint_failure);
- if (tree ti = DECL_TEMPLATE_INFO (fn))
- {
- r->u.template_instantiation.tmpl = TI_TEMPLATE (ti);
- r->u.template_instantiation.targs = TI_ARGS (ti);
- }
- else
- {
- r->u.template_instantiation.tmpl = fn;
- r->u.template_instantiation.targs = NULL_TREE;
- }
return r;
}
@@ -2251,10 +2239,9 @@ add_function_candidate (struct z_candidate **candidates,
/* Second, for a function to be viable, its constraints must be
satisfied. */
- if (flag_concepts && viable
- && !constraints_satisfied_p (fn))
+ if (flag_concepts && viable && !constraints_satisfied_p (fn))
{
- reason = constraint_failure (fn);
+ reason = constraint_failure ();
viable = false;
}
@@ -3729,11 +3716,7 @@ print_z_candidate (location_t loc, const char *msgstr,
"class type is invalid");
break;
case rr_constraint_failure:
- {
- tree tmpl = r->u.template_instantiation.tmpl;
- tree args = r->u.template_instantiation.targs;
- diagnose_constraints (cloc, tmpl, args);
- }
+ diagnose_constraints (cloc, fn, NULL_TREE);
break;
case rr_inherited_ctor:
inform (cloc, " an inherited constructor is not a candidate for "
@@ -4532,25 +4515,7 @@ build_new_function_call (tree fn, vec<tree, va_gc> **args,
through flags so that later we can use it to decide whether to warn
about peculiar null pointer conversion. */
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
- {
- /* If overload resolution selects a specialization of a
- function concept for non-dependent template arguments,
- the expression is true if the constraints are satisfied
- and false otherwise.
-
- NOTE: This is an extension of Concepts Lite TS that
- allows constraints to be used in expressions. */
- if (flag_concepts && !processing_template_decl)
- {
- tree tmpl = DECL_TI_TEMPLATE (cand->fn);
- tree targs = DECL_TI_ARGS (cand->fn);
- tree decl = DECL_TEMPLATE_RESULT (tmpl);
- if (DECL_DECLARED_CONCEPT_P (decl))
- return evaluate_function_concept (decl, targs);
- }
-
- flags |= LOOKUP_EXPLICIT_TMPL_ARGS;
- }
+ flags |= LOOKUP_EXPLICIT_TMPL_ARGS;
result = build_over_call (cand, flags, complain);
}
@@ -10828,8 +10793,11 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
return winner;
}
- // C++ Concepts
- // or, if not that, F1 is more constrained than F2.
+ /* Concepts: ... or, if not that, F1 is more constrained than F2.
+
+ FIXME: For function templates with no winner, this subsumption may
+ be computed a separate time. This needs to be validated, and if
+ so, the redundant check removed. */
if (flag_concepts && DECL_P (cand1->fn) && DECL_P (cand2->fn))
{
winner = more_constrained (cand1->fn, cand2->fn);