[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 05:28:09 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Haojian Wu (hokein)

<details>
<summary>Changes</summary>

This is an oversight spot in #<!-- -->86869, we should always check the invalid bit after constructing the `Sema::InstantiatingTemplate` RAII object.

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


1 Files Affected:

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


``````````diff
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index a2d8ba9a96d7a4..61979816bf4e3c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E) {
           S, CSE->getExprLoc(),
           Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
           CSE->getSourceRange());
+      if (Inst.isInvalid())
+        return std::nullptr;
       // C++ [temp.constr.normal]p1.1
       // [...]
       // The normal form of an id-expression of the form C<A1, A2, ..., AN>,

``````````

</details>


https://github.com/llvm/llvm-project/pull/86943


More information about the cfe-commits mailing list