https://github.com/Backl1ght created 
https://github.com/llvm/llvm-project/pull/165098

fix https://github.com/llvm/llvm-project/issues/163837

>From c55a21e42d56b35f343c728fc35fa5d089d50154 Mon Sep 17 00:00:00 2001
From: Backl1ght <[email protected]>
Date: Sat, 25 Oct 2025 14:25:55 +0000
Subject: [PATCH] fix

---
 clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 28925cca8f956..9c1bbb405ad22 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -7061,8 +7061,15 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation 
Loc, NamedDecl *D,
     // anonymous unions in class templates).
   }
 
-  if (!ParentDependsOnArgs)
+  if (!ParentDependsOnArgs) {
+    if (auto Found =
+            CurrentInstantiationScope
+                ? CurrentInstantiationScope->getInstantiationOfIfExists(D)
+                : nullptr) {
+        return cast<NamedDecl>(Found->dyn_cast<Decl *>());
+    }
     return D;
+  }
 
   ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
   if (!ParentDC)

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

Reply via email to