================
@@ -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 *>());
----------------
Fznamznon wrote:

Using of `dyn_cast` is strange here IMO, since the around `cast` doesn't expect 
null. If that is always a Decl there, we probably need to use `get` here.

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

Reply via email to