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

Christian Kandeler via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 02:56:55 PDT 2026


================
@@ -4265,6 +4265,19 @@ class LookupVisibleHelper {
           const auto *TST = BaseType->getAs<TemplateSpecializationType>();
           if (!TST)
             continue;
+          // The base may be named through an alias template, whose
+          // TemplateName is a TypeAliasTemplateDecl rather than the
+          // ClassTemplateDecl we are after. Look through the alias, otherwise
+          // the base is skipped entirely. libstdc++'s std::allocator<T> hits
+          // this: it derives from __allocator_base<T>, an alias template for
+          // __new_allocator<T>.
+          while (TST->isTypeAlias()) {
+            const auto *Aliased =
+                TST->getAliasedType()->getAs<TemplateSpecializationType>();
+            if (!Aliased)
+              break;
+            TST = Aliased;
----------------
ckandeler wrote:

Done.

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


More information about the cfe-commits mailing list