Re: [C++ Patch] PR 57397

2014-07-30 Thread Jason Merrill
On 07/30/2014 03:00 PM, Paolo Carlini wrote: + /* Fail if parms are left and they don't have default values and + they aren't all deduced as empty packs, eg (c++/57397): + + template + void foo(T1, Tn..., Tm...); + + int main() + { + foo(1); + } */ Let's drop the

Re: [C++ Patch] PR 57397

2014-07-30 Thread Paolo Carlini
... I'm finishing testing the below. Thanks! Paolo. // Index: cp/pt.c === --- cp/pt.c (revision 213287) +++ cp/pt.c (working copy) @@ -5517,13 +5517,21 @@ unify_method_type_error (bool explain_p, tree arg

Re: [C++ Patch] PR 57397

2014-07-30 Thread Paolo Carlini
Hi, On 07/30/2014 07:19 PM, Jason Merrill wrote: On 07/30/2014 11:09 AM, Paolo Carlini wrote: + /* Eg (c++/57397): + + template + void foo(T1, Tn..., Tm...); + + int main() + { +foo(1, 2); + } */ I think we should accept this: T1 is int, Tn is {}, Tm is

Re: [C++ Patch] PR 57397

2014-07-30 Thread Jason Merrill
On 07/30/2014 11:09 AM, Paolo Carlini wrote: + /* Eg (c++/57397): + + template + void foo(T1, Tn..., Tm...); + + int main() + { +foo(1, 2); + } */ I think we should accept this: T1 is int, Tn is {}, Tm is {int}. + template + void foo(T1, Tn..., T

Re: [C++ Patch] PR 57397

2014-07-30 Thread Paolo Carlini
Hi again, the below tries to also fix the second problem I presented in this thread. Passes testing on x86_64-linux. How does it look? Thanks, Paolo. /// Index: cp/pt.c === --- cp/pt.c (revision 213287) +++ cp

Re: [C++ Patch] PR 57397

2014-07-29 Thread Paolo Carlini
Hi, On 07/29/2014 06:56 PM, Jason Merrill wrote: On 07/29/2014 12:23 PM, Paolo Carlini wrote: On 07/29/2014 06:01 PM, Jason Merrill wrote: 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 c

Re: [C++ Patch] PR 57397

2014-07-29 Thread Jason Merrill
On 07/29/2014 12:23 PM, Paolo Carlini wrote: On 07/29/2014 06:01 PM, Jason Merrill wrote: 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 me

Re: [C++ Patch] PR 57397

2014-07-29 Thread Paolo Carlini
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_r

Re: [C++ Patch] PR 57397

2014-07-29 Thread Jason Merrill
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". @@ -16598,6 +16608,8 @@ type_unification_real (tree tparms, tree argvec; tree parmvec = make_tree_vec (1); + remaining_pack_p = tr

[C++ Patch] PR 57397

2014-07-29 Thread Paolo Carlini
Hi, in this diagnostic issue Jon noticed that for testcases like: template void foo(T1, Tn...); int main() { foo(); } we provide diagnostic saying "candidate expects 2 arguments, 0 provided", whereas of course we want to say something like "candidate expects at least 1 argument, 0 provided