<div dir="ltr"><div><div><div><div>Hi,<br><br></div><div>I'm quite new to this list, I guess this is the right place to post; if not, please, let me know.<br></div><div><br></div>I'm
using clang tooling to get the clang AST from C++11 code. I'm having
trouble with a TemplateSpecializationType in the following source code :<br>------------------------------<wbr>------------------------------<wbr>-------------------<br></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">template<typename _T> struct S;<br>template<template<_U> class _C, typename _T> struct S<_C<_T>> {};</span></div></div>------------------------------<wbr>------------------------------<wbr>-------------------<br><br></div>The
second declaration is a template specialization of the first
declaration which template argument is an instantiation of a template
template parameter (1st template parameter) with the second template
parameter.<br><div>Clang AST shows the template argument as being the
second template parameter in the following dump ("clang -Xclang
-ast-dump -fsyntax-only ..."), which seems incorrect:<br></div><div>------------------------------<wbr>------------------------------<wbr>-------------------<br></div><div><span style="font-family:monospace,monospace">... (ClassTemplateDecl for 1st declaration of struct S)</span><br><span style="font-family:monospace,monospace"></span><span style="font-family:monospace,monospace">`-<wbr>ClassTemplatePartialSpecializa<wbr>tionDecl 0x... <line:..., col:...> ... struct S definition</span><br><span style="font-family:monospace,monospace"> |-TemplateArgument type '<type-parameter-0-1>'</span><br><span style="font-family:monospace,monospace"> |-TemplateTemplateParmDecl 0x... <line:..., col:...> ... _C</span><br><span style="font-family:monospace,monospace"> | `-TemplateTypeParmDecl 0x... <line:..., col:...> ... typename _U</span><br><span style="font-family:monospace,monospace"> |-TemplateTypeParmDecl 0x... <line:..., col:...> ...referenced typename _T</span><br><span style="font-family:monospace,monospace"> `-CXXRecordDecl 0x... <line:..., col:...> ... implicit struct S</span><br></div><div><div style="margin-left:40px"><span style="font-family:monospace,monospace"></span></div></div>------------------------------<wbr>------------------------------<wbr>-------------------<br><br>On
the other hand, in the AST clang builds, it appears that
TemplateArgument type '<type-parameter-0-1>' has type
TemplateSpecializationType whose TemplateName (getTemplateName()) is a
TemplateDecl (getKind() and getAsTemplateDecl()). The TemplateDecl is a
bogus TemplateTemplateParmDecl which has no name, whereas it should be
the "_C" TemplateTemplateParmDecl.<br><br>Is this a bug?<br>Has it been reported?<br>Should I report it myself? (How should I do?)<br>I could not find any information. Please let me know.<br>Note that the source code seems to compile ok (clang does not crash).<br>Regards</div>