tree tinst;
tree r = error_mark_node;
+ tree full_targs = targs;
+ if (TMPL_ARGS_DEPTH (targs)
+ < TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (fn)))
+ full_targs = (add_outermost_template_args
+ (DECL_TI_ARGS (DECL_TEMPLATE_RESULT (fn)),
+ targs));
+
if (decltype_p)
complain |= tf_decltype;
location_t loc = input_location;
bool incomplete = false;
+ if (explicit_targs == error_mark_node)
+ goto fail;
+
+ if (TMPL_ARGS_DEPTH (explicit_targs)
+ < TMPL_ARGS_DEPTH (full_targs))
+ explicit_targs = add_outermost_template_args (full_targs,
+ explicit_targs);
+
/* Adjust any explicit template arguments before entering the
substitution context. */
explicit_targs
goto fail;
/* Place the explicitly specified arguments in TARGS. */
+ explicit_targs = INNERMOST_TEMPLATE_ARGS (explicit_targs);
for (i = NUM_TMPL_ARGS (explicit_targs); i--;)
TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (explicit_targs, i);
}
checks = NULL;
ok = !type_unification_real (DECL_INNERMOST_TEMPLATE_PARMS (fn),
- targs, parms, args, nargs, /*subr=*/0,
+ full_targs, parms, args, nargs, /*subr=*/0,
strict, flags, &checks, explain_p);
if (!explain_p)
pop_tinst_level ();
static int
type_unification_real (tree tparms,
- tree targs,
+ tree full_targs,
tree xparms,
const tree *xargs,
unsigned int xnargs,
gcc_assert (xparms == NULL_TREE || TREE_CODE (xparms) == TREE_LIST);
gcc_assert (ntparms > 0);
+ tree targs = INNERMOST_TEMPLATE_ARGS (full_targs);
+
/* Reset the number of non-defaulted template arguments contained
in TARGS. */
NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs) = NULL_TREE;
arg = args[ia];
++ia;
- if (unify_one_argument (tparms, targs, parm, arg, subr, strict,
+ if (unify_one_argument (tparms, full_targs, parm, arg, subr, strict,
explain_p))
return 1;
}
/* Copy the parameter into parmvec. */
TREE_VEC_ELT (parmvec, 0) = TREE_VALUE (parms);
- if (unify_pack_expansion (tparms, targs, parmvec, argvec, strict,
+ if (unify_pack_expansion (tparms, full_targs, parmvec, argvec, strict,
/*subr=*/subr, explain_p))
return 1;
location_t save_loc = input_location;
if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
- arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
- arg = convert_template_argument (parm, arg, targs, complain,
+ arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE);
+ arg = convert_template_argument (parm, arg, full_targs, complain,
i, NULL_TREE);
input_location = save_loc;
*checks = get_deferred_access_checks ();