[clang] [WIP] fix gh163837 (PR #165098)
Zhikai Zeng via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 25 07:28:13 PDT 2025
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 <backlight.zzk at gmail.com>
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)
More information about the cfe-commits
mailing list