[PATCH] D32348: [libclang] Check for a record declaration before a template specialization.

Emilio Cobos Álvarez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 26 15:11:44 PDT 2017


emilio added a comment.

In https://reviews.llvm.org/D32348#738704, @rsmith wrote:

> This change looks like it introduces a regression itself: given
>
>   template<typename T> struct A {};
>   template<typename T> using B = A<T*>;
>   B<int> bi;
>
>
> ... requesting the template arguments for the type `B<int>` changes from producing  `int` to producing `int*` with this patch, which seems to directly oppose the intentions of https://reviews.llvm.org/D26663.


FWIW when I wrote https://reviews.llvm.org/D26663, I did it because arguments weren't inspectionable at all for `using` declarations. Actually both of them would've worked for me.

>   template<typename T> using C = T;
> 
> 
> With this patch, requesting the template arguments for `C<int>` gives `int` but requesting the template arguments of `C<A<void>>` gives `void` rather than `A<void>`.

That being said, that is _specially_ annoying (good catch btw). Annoying enough to justify reverting this change I'd say...

I'll submit something with the test-cases. I guess people that depended on the old translation will just need to live with it... shrug.

I guess I could do something clever like: If it's both a `ClassTemplateSpecializationDecl`, and a `TemplateSpecializationType`, and the template arguments of the second happen to not be a template specialization, then use the `ClassTemplateSpecializationDecl`, otherwise the other, but that seems fairly tricky to maintain, so I'd rather just do the former.

Thanks for looking through it, btw.


Repository:
  rL LLVM

https://reviews.llvm.org/D32348





More information about the cfe-commits mailing list