[cfe-commits] [patch] pr9786 assert-on-invalid non-final parameter packs

David Blaikie dblaikie at gmail.com
Tue Oct 18 22:22:59 PDT 2011


On Tue, Oct 18, 2011 at 9:42 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Oct 13, 2011, at 10:09 PM, David Blaikie wrote:
>
> [& of course I forget to include the patch. Attached now]
>
> On Thu, Oct 13, 2011 at 10:09 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> From the bug:
>>
>> template<int ...Values, int After> struct X0nt;
>> X0nt<42> f();
>>
>> Causes clang to fail an assertion (SemaTemplate.cpp:4868 - "Converted
>> template argument list is too short!"). This fix causes
>> CheckTemplateArgumentList to fail if there are parameter packs anywhere
>> other than the last argument in a non-partial application of the template
>> arguments (partial applications include function templates for which
>> non-final parameter packs may be valid. This change does not regress that
>> behavior as far as I know/as far as the test cases already cover it).
>>
>> I've included a test for this fix.
>>
>> As an added bonus, I've also fixed a minor quirk in the output of the
>> diagnostic that appears here ("template parameter pack must be the last
>> template parameter") - currently/without my patch, Clang produces this
>> diagnostic for every parameter after a parameter pack. So in the case of
>> "template<typename ...A, typename B, typename C> struct foo;" the error is
>> emitted twice (though, strangely, the second type it is produced it does not
>> provide the context/line location, though the line/col numbers are the same
>> & still correct). I've fixed that issue & modified a test case to catch it
>> too.
>>
>> Let me know if this looks good & I'll check it in,
>
> LGTM!

Thanks Doug, committed as r142473 & resolved pr9786 as fixed.

- David



More information about the cfe-commits mailing list