Skip to content

Commit 7a9c8f2

Browse files
committed
Add comments
1 parent 232def4 commit 7a9c8f2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang/include/clang/Sema/SemaConcept.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ template <typename AtomicSubsumptionEvaluator>
262262
bool FoldExpandedConstraint::subsumes(
263263
const FoldExpandedConstraint &Other,
264264
const AtomicSubsumptionEvaluator &E) const {
265+
266+
// [C++26] [temp.constr.order]
267+
// a fold expanded constraint A subsumes another fold expanded constraint B if
268+
// they are compatible for subsumption, have the same fold-operator, and the
269+
// constraint of A subsumes that of B
270+
265271
if (Kind != Other.Kind || !AreCompatibleForSubsumption(*this, Other))
266272
return false;
267273

clang/lib/Sema/SemaConcept.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,8 @@ NormalizedConstraint::fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E) {
15761576
(FE->getOperator() == BinaryOperatorKind::BO_LAnd ||
15771577
FE->getOperator() == BinaryOperatorKind::BO_LOr)) {
15781578

1579+
// Normalize fold expressions in C++26.
1580+
15791581
FoldExpandedConstraint::FoldOperatorKind Kind =
15801582
FE->getOperator() == BinaryOperatorKind::BO_LAnd
15811583
? FoldExpandedConstraint::FoldOperatorKind::And
@@ -1609,6 +1611,11 @@ NormalizedConstraint::fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E) {
16091611

16101612
bool FoldExpandedConstraint::AreCompatibleForSubsumption(
16111613
const FoldExpandedConstraint &A, const FoldExpandedConstraint &B) {
1614+
1615+
// [C++26] [temp.constr.fold]
1616+
// Two fold expanded constraints are compatible for subsumption
1617+
// if their respective constraints both contain an equivalent unexpanded pack.
1618+
16121619
llvm::SmallVector<UnexpandedParameterPack> APacks, BPacks;
16131620
Sema::collectUnexpandedParameterPacks(const_cast<Expr *>(A.Pattern), APacks);
16141621
Sema::collectUnexpandedParameterPacks(const_cast<Expr *>(B.Pattern), BPacks);

0 commit comments

Comments
 (0)