<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 4, 2014 at 5:44 AM, Gabor Kozar <span dir="ltr"><<a href="mailto:kozargabor@gmail.com" target="_blank">kozargabor@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div><div>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.<br></div>
<div> </div>
<div>Is there any way for me to get the actual type that the user instantiated the template with? I tried <a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html#a8a5ee203ad0c4a166d12656b2a7cccbb" target="_blank">getTemplateSpecializationArgsAsWritten</a>() but it seems to always return NULL.</div></div></blockquote><div><br></div><div>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.)</div></div></div></div>