@@ -2939,26 +2939,18 @@ TemplateInstantiator::TransformNestedRequirement(
2939
2939
return Req;
2940
2940
}
2941
2941
2942
- #if 0
2943
- if (Req->isDependent() || AlwaysRebuild()) {
2944
- Sema::InstantiatingTemplate ReqInst(
2945
- SemaRef, Constraint->getBeginLoc(), Req,
2946
- Sema::InstantiatingTemplate::ConstraintsCheck{},
2947
- Constraint->getSourceRange());
2948
-
2949
- Sema::SFINAETrap Trap(SemaRef);
2950
-
2951
- TransConstraint = TransformExpr(const_cast<Expr *>(Constraint));
2952
- if (!TransConstraint.isUsable() || Trap.hasErrorOccurred()) {
2953
- return NestedReqWithDiag(Constraint, std::move(Satisfaction));
2954
- }
2955
- Constraint = TransConstraint.get();
2942
+ if (!getEvaluateConstraints ()) {
2943
+ ExprResult TransConstraint = TransformExpr (Req->getConstraintExpr ());
2944
+ if (TransConstraint.isInvalid () || !TransConstraint.get ())
2945
+ return nullptr ;
2946
+ if (TransConstraint.get ()->isInstantiationDependent ())
2947
+ return new (SemaRef.Context )
2948
+ concepts::NestedRequirement (TransConstraint.get ());
2949
+ ConstraintSatisfaction Satisfaction;
2950
+ return new (SemaRef.Context ) concepts::NestedRequirement (
2951
+ SemaRef.Context , TransConstraint.get (), Satisfaction);
2956
2952
}
2957
2953
2958
- if (Constraint->isInstantiationDependent())
2959
- return new (C) concepts::NestedRequirement(Constraint);
2960
- #endif
2961
-
2962
2954
bool Success;
2963
2955
Expr *NewConstraint;
2964
2956
TemplateDeductionInfo Info (Constraint->getBeginLoc ());
@@ -2991,8 +2983,12 @@ TemplateInstantiator::TransformNestedRequirement(
2991
2983
2992
2984
// FIXME: const correctness
2993
2985
// MLTAL might be dependent.
2994
- if (!NewConstraint)
2986
+ if (!NewConstraint) {
2987
+ if (!Satisfaction.IsSatisfied )
2988
+ return NestedReqWithDiag (Constraint, Satisfaction);
2989
+
2995
2990
NewConstraint = Constraint;
2991
+ }
2996
2992
return new (C) concepts::NestedRequirement (C, NewConstraint, Satisfaction);
2997
2993
}
2998
2994
0 commit comments