@@ -380,11 +380,12 @@ SubstitutionInTemplateArguments(
380
380
if (I < Used.size () && Used[I]) {
381
381
// SubstitutedOuterMost[I].dump();
382
382
// SubstArgs[MappedIndex].getArgument().dump();
383
+ TemplateArgument Arg = S.Context .getCanonicalTemplateArgument (
384
+ SubstArgs[MappedIndex++].getArgument ());
383
385
if (I < SubstitutedOuterMost.size ())
384
- SubstitutedOuterMost[I] = SubstArgs[MappedIndex++]. getArgument () ;
386
+ SubstitutedOuterMost[I] = Arg ;
385
387
else
386
- SubstitutedOuterMost.push_back (
387
- SubstArgs[MappedIndex++].getArgument ());
388
+ SubstitutedOuterMost.push_back (Arg);
388
389
}
389
390
MLTAL.replaceOutermostTemplateArguments (
390
391
const_cast <NamedDecl *>(Constraint.getConstraintDecl ()),
@@ -548,10 +549,6 @@ static bool calculateConstraintSatisfaction(
548
549
*SubstitutedArgs, Satisfaction, UnsignedOrNone (I));
549
550
if (!Success)
550
551
return false ;
551
- if (!Satisfaction.IsSatisfied || Satisfaction.ContainsErrors ) {
552
- if (Conjunction)
553
- return true ;
554
- }
555
552
if (!Conjunction && Satisfaction.IsSatisfied ) {
556
553
auto EffectiveDetailEnd = Satisfaction.Details .begin ();
557
554
std::advance (EffectiveDetailEnd, EffectiveDetailEndIndex);
@@ -1337,21 +1334,14 @@ static void diagnoseUnsatisfiedConstraintExpr(
1337
1334
static void DiagnoseUnsatisfiedConstraint (
1338
1335
Sema &S, ArrayRef<UnsatisfiedConstraintRecord> Records, SourceLocation Loc,
1339
1336
bool First = true , concepts::NestedRequirement *Req = nullptr ) {
1340
- std::vector<bool > Prevs;
1341
1337
for (auto &Record : Records) {
1342
1338
if (Record.isNull ()) {
1343
- First = Prevs.back ();
1344
- Prevs.pop_back ();
1339
+ First = false ;
1345
1340
continue ;
1346
1341
}
1347
1342
diagnoseUnsatisfiedConstraintExpr (S, Record, Loc, First, Req);
1348
1343
Loc = {};
1349
- if (isa<const ConceptReference *>(Record)) {
1350
- Prevs.push_back (First);
1351
- First = true ;
1352
- continue ;
1353
- }
1354
- First = false ;
1344
+ First = isa<const ConceptReference *>(Record);
1355
1345
}
1356
1346
}
1357
1347
@@ -1444,7 +1434,7 @@ static void diagnoseWellFormedUnsatisfiedConstraintExpr(Sema &S,
1444
1434
return ;
1445
1435
} else if (auto *CSE = dyn_cast<ConceptSpecializationExpr>(SubstExpr)) {
1446
1436
// Drill down concept ids treated as atomic constraints
1447
- S.DiagnoseUnsatisfiedConstraint (CSE);
1437
+ S.DiagnoseUnsatisfiedConstraint (CSE, First );
1448
1438
return ;
1449
1439
} else if (auto *TTE = dyn_cast<TypeTraitExpr>(SubstExpr);
1450
1440
TTE && TTE->getTrait () == clang::TypeTrait::BTT_IsDeducible) {
@@ -1494,7 +1484,7 @@ void Sema::DiagnoseUnsatisfiedConstraint(
1494
1484
}
1495
1485
1496
1486
void Sema::DiagnoseUnsatisfiedConstraint (
1497
- const ConceptSpecializationExpr *ConstraintExpr) {
1487
+ const ConceptSpecializationExpr *ConstraintExpr, bool First ) {
1498
1488
1499
1489
const ASTConstraintSatisfaction &Satisfaction =
1500
1490
ConstraintExpr->getSatisfaction ();
@@ -1503,7 +1493,7 @@ void Sema::DiagnoseUnsatisfiedConstraint(
1503
1493
" Attempted to diagnose a satisfied constraint" );
1504
1494
1505
1495
::DiagnoseUnsatisfiedConstraint (*this , Satisfaction.records(),
1506
- ConstraintExpr->getBeginLoc());
1496
+ ConstraintExpr->getBeginLoc(), First );
1507
1497
}
1508
1498
1509
1499
const NormalizedConstraint *Sema::getNormalizedAssociatedConstraints (
@@ -1602,11 +1592,9 @@ substituteParameterMappings(Sema &S, NormalizedConstraintWithParamMapping &N,
1602
1592
if (S.SubstTemplateArgumentsInParameterMapping (N.getParameterMapping (), MLTAL,
1603
1593
SubstArgs))
1604
1594
return true ;
1605
-
1606
1595
TemplateArgumentLoc *TempArgs =
1607
1596
new (S.Context ) TemplateArgumentLoc[SubstArgs.size ()];
1608
- std::copy (SubstArgs.arguments ().begin (), SubstArgs.arguments ().end (),
1609
- TempArgs);
1597
+ llvm::copy (SubstArgs.arguments (), TempArgs);
1610
1598
N.updateParameterMapping (
1611
1599
N.mappingOccurenceList (),
1612
1600
MutableArrayRef<TemplateArgumentLoc>(TempArgs, SubstArgs.size ()));
0 commit comments