================
@@ -2540,12 +2548,15 @@ Decl 
*TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
 
   VarTemplateDecl *VarTemplate = D->getSpecializedTemplate();
 
-  // Lookup the already-instantiated declaration and return that.
+  // Lookup the already-instantiated declaration in the instantiation
+  // of the class template and return that.
   DeclContext::lookup_result Found = Owner->lookup(VarTemplate->getDeclName());
-  assert(!Found.empty() && "Instantiation found nothing?");
+  if (Found.empty())
+    return nullptr;
 
   VarTemplateDecl *InstVarTemplate = dyn_cast<VarTemplateDecl>(Found.front());
-  assert(InstVarTemplate && "Instantiation did not find a variable template?");
----------------
iamaayushrivastava wrote:

Restored. The null checks were added defensively in the previous iteration 
before the root fix in `VisitVarDecl` was in place. Now that `VisitVarDecl` 
guarantees the `VarTemplateDecl` is always registered in the owner, the asserts 
hold unconditionally.

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

Reply via email to