<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On 17 Aug 2017 9:47 am, "Pouet fourtytwo via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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">`-ClassTemplatePartialSpeciali<wbr>zationDecl 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></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Yes, albeit a minor one since we should never be showing this name to the user.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Has it been reported?<br>Should I report it myself? (How should I do?)<br></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Feel free (see <a href="http://bugs.llvm.org">bugs.llvm.org</a>).</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div></div>