This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 57397


Hi,

On 07/29/2014 06:01 PM, Jason Merrill wrote:
On 07/29/2014 10:28 AM, Paolo Carlini wrote:
+unify_arity (bool explain_p, int have, int wanted, bool lb_p = false)

I don't understand "lb_p".
lower_bound ;) The first name which came to my mind...

@@ -16598,6 +16608,8 @@ type_unification_real (tree tparms,
       tree argvec;
       tree parmvec = make_tree_vec (1);

+      remaining_pack_p = true;
+
       /* Allocate a TREE_VEC and copy in all of the arguments */
       argvec = make_tree_vec (nargs - ia);
       for (i = 0; ia < nargs; ++ia, ++i)

Why would we get here in the too few args case? Won't we only hit this code if we had enough args for the non-pack parms?
Yeah, that is exactly for the cases I was mentioning at the end of the my first message, eg:

template<class T1, class... T2, class... T3>
void boo(T1, T2..., T3...)
{ }

int main()
{
  boo(1);
}

the patch as-is leads to a diagnostic similar to the current one, thus saying: "candidate expects at least 2 arguments, 1 provided" whereas the current one says: "candidate expects 2 arguments, 1 provided". That seems fine, given the current status, because indeed, passing:

int main()
{
  boo(1, 2);
}

or, for that matter:

int main()
{
  boo(1, 2, 3);
}

are both accepted.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]