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

Richard Smith richard at metafoo.co.uk
Mon Apr 30 10:36:51 PDT 2012


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?

Other than that, LGTM!

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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120430/034e9813/attachment.html>


More information about the cfe-commits mailing list