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

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 26 14:35:50 PDT 2017


rsmith added a comment.

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.

If the intent of this libclang function is to request the template arguments of the type as written, this change is wrong. If the intent is to request the template arguments of the desugared type, then https://reviews.llvm.org/D26663 is wrong. But either way, it seems that reversing the order of these checks causes us to produce inconsistent results. Another example of the inconsistency:

  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>`.


Repository:
  rL LLVM

https://reviews.llvm.org/D32348





More information about the cfe-commits mailing list