[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 01:37:44 PST 2023


jcsxky wrote:

> The problem may be related to the fact that template parameter declarations can have the `TranslationUnitDecl` as parent until the template (with these parameters) is finally created. In the temporary phase the object (`TemplateTypeParmDecl`) is found with lookup if it has the same name as an other imported object. Does the crash happen if in the test code the `TypeAliasTemplateDecl` is replaced with a plain `ClassTemplateDecl` or `FunctionTemplateDecl`? If yes the change is needed at these import functions too.


Replace `TypeAliasTemplateDecl` with `ClassTemplateDecl` or `FunctionTemplateDecl` has no problem and passed the test with following test code
```cpp
struct S;
template <typename>
class Callable {};
template <typename Callable>
int bindingFunctionVTable;
```
and
```cpp
struct S;
template <typename>
void Callable(){}
template <typename Callable>
int bindingFunctionVTable;
```
Test code seems good to current issue and the two you mentioned above can't be fixed with this pr. Should I abandon this pr or fix current issue only first?

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


More information about the cfe-commits mailing list