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.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 148ef8f..3915738 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -451,7 +451,6 @@ enum rejection_reason_code {
rr_arg_conversion,
rr_bad_arg_conversion,
rr_template_unification,
- rr_template_instantiation,
rr_invalid_copy
};
@@ -485,7 +484,7 @@ struct rejection_reason {
struct {
tree tmpl;
tree explicit_targs;
- tree targs;
+ int num_targs;
const tree *args;
unsigned int nargs;
tree return_type;
@@ -688,7 +687,7 @@ template_unification_rejection (tree tmpl, tree explicit_targs, tree targs,
struct rejection_reason *r = alloc_rejection (rr_template_unification);
r->u.template_unification.tmpl = tmpl;
r->u.template_unification.explicit_targs = explicit_targs;
- r->u.template_unification.targs = targs;
+ r->u.template_unification.num_targs = TREE_VEC_LENGTH (targs);
/* Copy args to our own storage. */
memcpy (args1, args, args_n_bytes);
r->u.template_unification.args = args1;
@@ -706,15 +705,6 @@ template_unification_error_rejection (void)
}
static struct rejection_reason *
-template_instantiation_rejection (tree tmpl, tree targs)
-{
- struct rejection_reason *r = alloc_rejection (rr_template_instantiation);
- r->u.template_instantiation.tmpl = tmpl;
- r->u.template_instantiation.targs = targs;
- return r;
-}
-
-static struct rejection_reason *
invalid_copy_with_fn_template_rejection (void)
{
struct rejection_reason *r = alloc_rejection (rr_invalid_copy);
@@ -2873,7 +2863,6 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
unsigned int ia, ix;
tree arg;
struct z_candidate *cand;
- int i;
tree fn;
struct rejection_reason *reason = NULL;
int errs;
@@ -2920,12 +2909,12 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
gcc_assert (ia == nargs_without_in_chrg);
errs = errorcount+sorrycount;
- i = fn_type_unification (tmpl, explicit_targs, targs,
- args_without_in_chrg,
- nargs_without_in_chrg,
- return_type, strict, flags, false);
+ fn = fn_type_unification (tmpl, explicit_targs, targs,
+ args_without_in_chrg,
+ nargs_without_in_chrg,
+ return_type, strict, flags, false);
- if (i != 0)
+ if (fn == error_mark_node)
{
/* Don't repeat unification later if it already resulted in errors. */
if (errorcount+sorrycount == errs)
@@ -2938,13 +2927,6 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
goto fail;
}
- fn = instantiate_template (tmpl, targs, tf_none);
- if (fn == error_mark_node)
- {
- reason = template_instantiation_rejection (tmpl, targs);
- goto fail;
- }
-
/* In [class.copy]:
A member function template is never instantiated to perform the
@@ -3239,7 +3221,8 @@ print_z_candidate (location_t loc, const char *msgstr,
inform (cloc, " template argument deduction/substitution failed:");
fn_type_unification (r->u.template_unification.tmpl,
r->u.template_unification.explicit_targs,
- r->u.template_unification.targs,
+ (make_tree_vec
+ (r->u.template_unification.num_targs)),
r->u.template_unification.args,
r->u.template_unification.nargs,
r->u.template_unification.return_type,
@@ -3247,12 +3230,6 @@ print_z_candidate (location_t loc, const char *msgstr,
r->u.template_unification.flags,
true);
break;
- case rr_template_instantiation:
- /* Re-run template instantiation with diagnostics. */
- instantiate_template (r->u.template_instantiation.tmpl,
- r->u.template_instantiation.targs,
- tf_warning_or_error);
- break;
case rr_invalid_copy:
inform (cloc,
" a constructor taking a single argument of its own "