[clang] Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585, #111173)" (PR #111852)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 08:29:47 PDT 2024


ilya-biryukov wrote:

> @ilya-biryukov When instantiating a template from a member template that was explicitly specialized for a given implicitly instantiated specialization of its enclosing class template, we need to keep track of which template was actually used as the primary template (since we consider the specialization to be a redeclaration of the (instantiated) member template). Since the initial declaration & the specialized declaration have different template depths, this (may) result in `getTemplateInstantiationArgs` returning an incomplete set of template arguments for an entity.


so this is for cases like this, right?
```cpp
template <class T>
struct Foo {
    template <class>
    struct Bar {
        int foo = 10;
    };
};

template <>
template <class T>
struct Foo<int>::Bar {
    int foo = 10;
};
```

who do we strictly need to change what we pick in the simpler cases above? (my guess would be that we want simpler code, but I want to confirm it)


Do you have any ideas on how to revert back to the old behavior? In the code example above, I would've expected that using canonical declaration after getting template instantiation pattern would give us the same results as before.
Any idea why that isn't happening?

https://github.com/llvm/llvm-project/pull/111852


More information about the cfe-commits mailing list