[PATCH] Fix PR c++/69052 (argument pack deduction failure during overload resolution)

Patrick Palka patrick@parcs.ath.cx
Sun Dec 27 17:11:00 GMT 2015


On Sun, Dec 27, 2015 at 12:05 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> On Sun, Dec 27, 2015 at 12:02 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
>> In try_one_overload(), it should not be a deduction failure if we
>> deduced more arguments of an argument pack than were explicitly
>> specified (as long as the arguments are otherwise equivalent).
>>
>> This patch makes try_one_overload() manually check the argument packs,
>> to permit such a case.
>>
>> Bootstrap + regtest in progress on x86_64-pc-linux-gnu, will also test
>> against Boost.  Is this OK to commit if testing succeeds?
>>
>> gcc/cp/ChangeLog:
>>
>>         PR c++/69052
>>         * pt.c (try_one_overload): Handle comparing argument packs so
>>         that there is no conflict if we deduced more arguments of an
>>         argument pack than were explicitly specified.
>>
>> gcc/testsuite/ChangeLog:
>>
>>         PR c++/69052
>>         g++.dg/cpp0x/pr69056.C: New test.
>> ---
>>  gcc/cp/pt.c                          | 21 +++++++++++++++++++++
>>  gcc/testsuite/g++.dg/cpp0x/pr69056.C | 30 ++++++++++++++++++++++++++++++
>>  2 files changed, 51 insertions(+)
>>  create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr69056.C
>>
>> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
>> index ff16b7c..cdbfadd 100644
>> --- a/gcc/cp/pt.c
>> +++ b/gcc/cp/pt.c
>> @@ -18694,6 +18694,27 @@ try_one_overload (tree tparms,
>>            template args used in the function parm list with our own
>>            template parms.  Discard them.  */
>>         TREE_VEC_ELT (tempargs, i) = NULL_TREE;
>> +      else if (oldelt && ARGUMENT_PACK_P (oldelt))
>> +       {
>> +         /* Check that the deduced argument at each index is equivalent to the
>> +            corresponding explicit argument.  We may have deduced more
>> +            arguments than were explicitly specified, and that's OK.  */
>
> Oops, I forgot to --amend a clarity change to the above comment.  It
> should read:
>
>          /* Check that the argument at each index of the deduced argument pack
>             is equivalent to the corresponding explicitly specified argument.
>             We may have deduced more arguments than were explicitly specified,
>             and that's OK.  */

... And I just realize I have been referring to the wrong PR :( It
should be c++/69056 not 69052... Sorry.

I suppose I will just resend a fixed version of this patch in a new
thread. Please ignore this one.



More information about the Gcc-patches mailing list