@@ -550,9 +550,7 @@ static bool calculateConstraintSatisfaction(
550
550
if (!Success)
551
551
return false ;
552
552
if (!Conjunction && Satisfaction.IsSatisfied ) {
553
- auto EffectiveDetailEnd = Satisfaction.Details .begin ();
554
- std::advance (EffectiveDetailEnd, EffectiveDetailEndIndex);
555
- Satisfaction.Details .erase (EffectiveDetailEnd,
553
+ Satisfaction.Details .erase (Satisfaction.Details .begin () + EffectiveDetailEndIndex,
556
554
Satisfaction.Details .end ());
557
555
break ;
558
556
}
@@ -635,24 +633,34 @@ static bool calculateConstraintSatisfaction(
635
633
ConstraintSatisfaction &Satisfaction,
636
634
UnsignedOrNone PackSubstitutionIndex) {
637
635
636
+ auto EffectiveDetailEndIndex = Satisfaction.Details .size ();
637
+
638
638
bool Ok = calculateConstraintSatisfaction (
639
639
S, Constraint.getLHS (), Template, TemplateNameLoc, MLTAL, Satisfaction,
640
640
PackSubstitutionIndex);
641
641
642
642
if (!Ok || Satisfaction.ContainsErrors )
643
- return false ;
643
+ return Ok ;
644
644
645
645
if (Satisfaction.IsSatisfied &&
646
646
Constraint.getCompoundKind () == NormalizedConstraint::CCK_Disjunction) {
647
647
return true ;
648
648
}
649
649
if (!Satisfaction.IsSatisfied &&
650
- Constraint.getCompoundKind () == NormalizedConstraint::CCK_Conjunction)
650
+ Constraint.getCompoundKind () == NormalizedConstraint::CCK_Conjunction) {
651
651
return true ;
652
+ }
652
653
653
- return calculateConstraintSatisfaction (S, Constraint.getRHS (), Template,
654
+ Satisfaction.ContainsErrors = false ;
655
+ Satisfaction.IsSatisfied = false ;
656
+
657
+ Ok = calculateConstraintSatisfaction (S, Constraint.getRHS (), Template,
654
658
TemplateNameLoc, MLTAL, Satisfaction,
655
659
PackSubstitutionIndex);
660
+ if (Ok && Satisfaction.IsSatisfied && !Satisfaction.ContainsErrors )
661
+ Satisfaction.Details .erase (Satisfaction.Details .begin () + EffectiveDetailEndIndex,
662
+ Satisfaction.Details .end ());
663
+ return Ok;
656
664
}
657
665
658
666
static bool calculateConstraintSatisfaction (
@@ -1349,6 +1357,7 @@ static void diagnoseUnsatisfiedRequirement(Sema &S,
1349
1357
concepts::NestedRequirement *Req,
1350
1358
bool First) {
1351
1359
DiagnoseUnsatisfiedConstraint (S, Req->getConstraintSatisfaction ().records (),
1360
+ Req->hasInvalidConstraint () ? SourceLocation () :
1352
1361
Req->getConstraintExpr ()->getExprLoc (), First,
1353
1362
Req);
1354
1363
}
0 commit comments