[clang] [Clang] Fix name lookup for dependent bases (PR #114978)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 6 11:53:47 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list