llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (smanna12)

<details>
<summary>Changes</summary>

This patch adds a null check for InstantiatedFrom to prevent dereferencing a 
null pointer during the template instantiation process in 
clang::Sema::SetupConstraintScope().

The fix ensures that the function exits early with an appropriate error if the 
InstantiatedFrom pointer is not valid.

---
Full diff: https://github.com/llvm/llvm-project/pull/97913.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaConcept.cpp (+3) 


``````````diff
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 202dd86c67f62..353276e9b2802 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -636,6 +636,9 @@ bool Sema::SetupConstraintScope(
             ? FD->getInstantiatedFromMemberFunction()
             : FD->getInstantiatedFromDecl();
 
+    if (!InstantiatedFrom)
+      return true;
+
     InstantiatingTemplate Inst(
         *this, FD->getPointOfInstantiation(),
         Sema::InstantiatingTemplate::ConstraintsCheck{}, InstantiatedFrom,

``````````

</details>


https://github.com/llvm/llvm-project/pull/97913
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to