[cfe-dev] Typedef type as template argument
richard at metafoo.co.uk
Tue Nov 4 20:15:00 PST 2014
On Tue, Nov 4, 2014 at 5:44 AM, Gabor Kozar <kozargabor at gmail.com> wrote:
> I have a FunctionDecl that is an instantiated FunctionTemplateDecl. I
> want to figure out if the template argument is a typedef type -
> unfortunately, the TemplateArgument only contains the desugared type. This
> makes sense, given the way templates work, but it's inconvenient.
> Is there any way for me to get the actual type that the user instantiated
> the template with? I tried getTemplateSpecializationArgsAsWritten
> but it seems to always return NULL.
Each user of the FunctionDecl might have different template arguments
(using different ways of writing the same type, for instance), so this
information isn't on the FunctionDecl. Look at the DeclRefExpr in the user
of the function; it will have the template arguments written in the call.
(FunctionDecl's getTemplateSpecializationArgsAsWritten is for explicit
specializations and the like, where the function template specialization is
explicitly written somewhere.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev