================
@@ -169,14 +169,18 @@ bool CXXBasePaths::lookupInBases(ASTContext &Context,
     // Find the record of the base class subobjects for this type.
     QualType BaseType =
         Context.getCanonicalType(BaseSpec.getType()).getUnqualifiedType();
+    bool isCurrentInstantiation = false;
+    if (auto *TST = BaseSpec.getType()->getAs<TemplateSpecializationType>())
+      isCurrentInstantiation = TST->isCurrentInstantiation();
----------------
mizvekov wrote:

This relies on a TemplateSpecializationType which is a type sugar to make this 
determination, and type sugar could be lost, for example with template 
instantiation.

Might be worth double checking and adding a test case where the base type is 
formed from instantiation.

This test would be equivalent to checking if the type is canonically an 
InjectedClassNameType:
```suggestion
    bool isCurrentInstantiation = isa<InjectedClassNameType>(BaseType);
```
This is reliable as it only depends on the canonical type.

https://github.com/llvm/llvm-project/pull/114978
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to