|
19 | 19 | #include "clang/AST/CharUnits.h" |
20 | 20 | #include "clang/AST/DeclObjC.h" |
21 | 21 | #include "clang/AST/ExprCXX.h" |
| 22 | +#include "clang/AST/ExprConcepts.h" |
22 | 23 | #include "clang/AST/ExprObjC.h" |
23 | 24 | #include "clang/AST/RecursiveASTVisitor.h" |
24 | 25 | #include "clang/AST/Type.h" |
@@ -9074,16 +9075,22 @@ Sema::BuildExprRequirement( |
9074 | 9075 | MLTAL.addOuterRetainedLevels(TPL->getDepth()); |
9075 | 9076 | const TypeConstraint *TC = Param->getTypeConstraint(); |
9076 | 9077 | assert(TC && "Type Constraint cannot be null here"); |
9077 | | - ExprResult Constraint = |
9078 | | - SubstExpr(TC->getImmediatelyDeclaredConstraint(), MLTAL); |
| 9078 | + auto *IDC = TC->getImmediatelyDeclaredConstraint(); |
| 9079 | + assert(IDC && "ImmediatelyDeclaredConstraint can't be null here."); |
| 9080 | + ExprResult Constraint = SubstExpr(IDC, MLTAL); |
9079 | 9081 | if (Constraint.isInvalid()) { |
9080 | | - Status = concepts::ExprRequirement::SS_ExprSubstitutionFailure; |
9081 | | - } else { |
9082 | | - SubstitutedConstraintExpr = |
9083 | | - cast<ConceptSpecializationExpr>(Constraint.get()); |
9084 | | - if (!SubstitutedConstraintExpr->isSatisfied()) |
9085 | | - Status = concepts::ExprRequirement::SS_ConstraintsNotSatisfied; |
9086 | | - } |
| 9082 | + return new (Context) concepts::ExprRequirement( |
| 9083 | + concepts::createSubstDiagAt(*this, IDC->getExprLoc(), |
| 9084 | + [&](llvm::raw_ostream &OS) { |
| 9085 | + IDC->printPretty(OS, /*Helper=*/nullptr, |
| 9086 | + getPrintingPolicy()); |
| 9087 | + }), |
| 9088 | + IsSimple, NoexceptLoc, ReturnTypeRequirement); |
| 9089 | + } |
| 9090 | + SubstitutedConstraintExpr = |
| 9091 | + cast<ConceptSpecializationExpr>(Constraint.get()); |
| 9092 | + if (!SubstitutedConstraintExpr->isSatisfied()) |
| 9093 | + Status = concepts::ExprRequirement::SS_ConstraintsNotSatisfied; |
9087 | 9094 | } |
9088 | 9095 | return new (Context) concepts::ExprRequirement(E, IsSimple, NoexceptLoc, |
9089 | 9096 | ReturnTypeRequirement, Status, |
|
0 commit comments