================
@@ -136,8 +160,22 @@ TagDecl 
*HeuristicResolverImpl::resolveTypeToTagDecl(QualType QT) {
   T = T->getCanonicalTypeInternal().getTypePtr();
 
   if (const auto *DNT = T->getAs<DependentNameType>()) {
-    T = resolveDeclsToType(resolveDependentNameType(DNT), Ctx)
-            .getTypePtrOrNull();
+    auto Decls = resolveDependentNameType(DNT);
+    QualType Resolved = resolveDeclsToType(Decls, Ctx);
+    // `Resolved` is canonical, so if the name refers to a member typedef of a
+    // template parameter (as `vector<T>::allocator_type` does), it has lost 
the
+    // TemplateTypeParmDecl we would need to fall back to the parameter's
+    // default argument. Consult the typedef's underlying type as written
+    // instead.
+    if (Decls.size() == 1) {
----------------
HighCommander4 wrote:

This logic can be moved into `resolveDeclsToType`.

In fact, since `resolveDeclsToType` already checks `Decls.size() == 1`, it's 
sufficient to add the code inside this block (handling TypedefNameDecl) to the 
helper `resolveDeclToType`.

https://github.com/llvm/llvm-project/pull/223667
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to