[cfe-dev] Type source info for function template instances.
John McCall
rjmccall at apple.com
Thu Mar 4 15:42:36 PST 2010
On Mar 4, 2010, at 5:49 AM, Enea Zaffanella wrote:
> John McCall wrote:
>> On Feb 18, 2010, at 3:17 PM, Enea Zaffanella wrote:
>>> In our client application, we need to visit all instantiations of
> >> template declarations. While at it, we were surprised to notice that
> >> the instantiations of function template declarations are provided with
> >> a TypeSourceInfo object that seems to be an exact copy of the one found
> >> in the corresponding templated decl.
>
> [...]
>
>> This is definitely just an oversight; the fix required is
>> more-or-less what you've proposed, except ideally we would only
> > transform the type once. If you'd like to look into the bugs
> > this exposes, that would be great; otherwise, please file a bug on this.
>> John.
>
> Hello John.
>
> One of the two errors was just due to the duplication of the expected diagnostics (since we were transforming twice the function parameters).
>
> We haven't found a simple way to avoid this double transformation:
> we can not just transform the parameters found in the function TSI (TypeSourceInfo), since this would disregard, e.g., default argument expressions. On the other hand, we found no (simple) way to separately transform the function declaration parameters and the function TSI components and then rebuild the full function TSI from those.
Can you not "reattach" default argument expressions during TemplateDeclInstantiator::SubstFunctionType()? Or even better, transform them appropriately in TreeTransform. I would be much more comfortable doing either of these than suppressing diagnostics assumed to be redundant.
John.
More information about the cfe-dev
mailing list