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

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 10:58:56 PDT 2024


Author: Haojian Wu
Date: 2024-03-28T18:58:52+01:00
New Revision: 599027857e1007ff402094a3a550b4832f3f5146

URL: https://github.com/llvm/llvm-project/commit/599027857e1007ff402094a3a550b4832f3f5146
DIFF: https://github.com/llvm/llvm-project/commit/599027857e1007ff402094a3a550b4832f3f5146.diff

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

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaConcept.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index a2d8ba9a96d7a4..b2986c5012ea2b 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::nullopt;
       // C++ [temp.constr.normal]p1.1
       // [...]
       // The normal form of an id-expression of the form C<A1, A2, ..., AN>,


        


More information about the cfe-commits mailing list