+2009-11-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/40371
+ * call.c (add_template_candidate_real): Early return NULL if
+ the arglist length is smaller than skip_without_in_chrg; tidy.
+
2009-11-30 Dodji Seketeli <dodji@redhat.com>
PR c++/42069
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
- unsigned int nargs;
- int skip_without_in_chrg;
- tree first_arg_without_in_chrg;
+ unsigned int len = VEC_length (tree, arglist);
+ unsigned int nargs = (first_arg == NULL_TREE ? 0 : 1) + len;
+ unsigned int skip_without_in_chrg = 0;
+ tree first_arg_without_in_chrg = first_arg;
tree *args_without_in_chrg;
unsigned int nargs_without_in_chrg;
unsigned int ia, ix;
int i;
tree fn;
- nargs = (first_arg == NULL_TREE ? 0 : 1) + VEC_length (tree, arglist);
-
- skip_without_in_chrg = 0;
-
- first_arg_without_in_chrg = first_arg;
-
/* We don't do deduction on the in-charge parameter, the VTT
parameter or 'this'. */
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl))
++skip_without_in_chrg;
}
+ if (len < skip_without_in_chrg)
+ return NULL;
+
nargs_without_in_chrg = ((first_arg_without_in_chrg != NULL_TREE ? 1 : 0)
- + (VEC_length (tree, arglist)
- - skip_without_in_chrg));
+ + (len - skip_without_in_chrg));
args_without_in_chrg = XALLOCAVEC (tree, nargs_without_in_chrg);
ia = 0;
if (first_arg_without_in_chrg != NULL_TREE)