[clang] [clang] Look through alias templates when visiting dependent base classes (PR #223713)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 03:17:14 PDT 2026


================
@@ -4262,7 +4262,12 @@ class LookupVisibleHelper {
             // there anyway.
             continue;
           }
-          const auto *TST = BaseType->getAs<TemplateSpecializationType>();
+          // Look through an alias template, whose TemplateName is a
+          // TypeAliasTemplateDecl rather than the ClassTemplateDecl we are
+          // after; otherwise the base is skipped entirely. libstdc++'s
+          // std::allocator<T> relies on this: it derives from
+          // __allocator_base<T>, an alias template for __new_allocator<T>.
+          const auto *TST = BaseType->getAsNonAliasTemplateSpecializationType();
----------------
zyn0217 wrote:

```suggestion
          // Look through an alias template, whose TemplateName is a
          // TypeAliasTemplateDecl rather than the ClassTemplateDecl we are
          // after; otherwise the base is skipped entirely.
```

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


More information about the cfe-commits mailing list