[cfe-commits] [patch] PR12378 - conversion warnings on default args of function templates
dblaikie at gmail.com
Mon Apr 30 09:40:21 PDT 2012
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.
More information about the cfe-commits