[cfe-dev] TemplateSpecializationType bug?

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 17 10:18:08 PDT 2017


On 17 Aug 2017 9:47 am, "Pouet fourtytwo via cfe-dev" <
cfe-dev at lists.llvm.org> wrote:

Hi,

I'm quite new to this list, I guess this is the right place to post; if
not, please, let me know.

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 :
------------------------------------------------------------
-------------------
template<typename _T> struct S;
template<template<_U> class _C, typename _T> struct S<_C<_T>> {};
------------------------------------------------------------
-------------------

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.
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:
------------------------------------------------------------
-------------------
... (ClassTemplateDecl for 1st declaration of struct S)
`-ClassTemplatePartialSpecializationDecl 0x... <line:..., col:...> ...
struct S definition
  |-TemplateArgument type '<type-parameter-0-1>'
  |-TemplateTemplateParmDecl 0x... <line:..., col:...> ... _C
  | `-TemplateTypeParmDecl 0x... <line:..., col:...> ... typename _U
  |-TemplateTypeParmDecl 0x... <line:..., col:...> ...referenced typename _T
  `-CXXRecordDecl 0x... <line:..., col:...> ... implicit struct S
------------------------------------------------------------
-------------------

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.

Is this a bug?


Yes, albeit a minor one since we should never be showing this name to the
user.

Has it been reported?
Should I report it myself? (How should I do?)


Feel free (see bugs.llvm.org).

I could not find any information. Please let me know.
Note that the source code seems to compile ok (clang does not crash).
Regards

_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170817/2411bedd/attachment.html>


More information about the cfe-dev mailing list