[cfe-commits] [patch] PR12378 - conversion warnings on default args of function templates

David Blaikie dblaikie at gmail.com
Mon Apr 30 11:23:07 PDT 2012


On Mon, Apr 30, 2012 at 10:36 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> Hi David,
>
> It's a little subtle that the NewDI != OldDI covers a 'parameter type is not
> dependent' check. Can you make that check a bit more explicit?

Yep - I meant to at least provide a comment there, sorry about that. I
changed it to directly test whether the parameter type is
instantiation dependent, rather than relying on the test implied by
the template instantiation logic.

> Other than that, LGTM!

Thanks, committed as r155838.

- David

>
> On Mon, Apr 30, 2012 at 10:00 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> Now with infinity percent more patch.
>>
>> On Mon, Apr 30, 2012 at 9:40 AM, David Blaikie <dblaikie at gmail.com> wrote:
>> > Apparently we weren't providing any of the -Wconversion warnings on
>> > (dependent and non-dependent) default arguments in function templates.
>> > So this patch fixes that.
>> >
>> > Also, we weren't caching instantiations of default arguments - so we'd
>> > reinstantiate them several times (& that meant providing the
>> > conversion warnings multiple times, given where I added them in). So I
>> > fixed that so we don't reinstantiate them, instead using
>> > "setDefaultArg" which it looks like the code was setup to use but had
>> > just missed the last step.
>> >
>> > The last part was that we instantiate completely non-dependent
>> > arguments (where the parameter type and the default arg expression are
>> > non-dependent) - this caused us to warn on non-dependent default args
>> > for every instantiation (in addition to warning once for the
>> > uninstantiated template itself - we were already doing that before my
>> > patch). So I changed that to store those default args directly rather
>> > than as uninstantiated default arguments. To the best of my
>> > understanding this seems correct - if an expression isn't
>> > instantiation dependent then what does it mean to instantiate it? But
>> > perhaps I've missed some important detail there. No tests fail because
>> > of this, though.
>> >
>> > Thanks,
>> > - David
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>



More information about the cfe-commits mailing list