Skip to content

Commit ffac140

Browse files
authored
[Clang] [Sema] Document invariant in Sema::AddOverloadCandidate (#135256)
Static analysis flagged 1 - ArgIdx in Sema::AddOverloadCandidate for its potential to overflow. Turns out this is intentional since when PO == OverloadCandidateParamOrder::Reversed Args.size() is always two, so this will never overflow. We document using an assert. Fixes: #135086
1 parent a4b7688 commit ffac140

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7189,6 +7189,7 @@ void Sema::AddOverloadCandidate(
71897189
}
71907190
}
71917191

7192+
assert(PO != OverloadCandidateParamOrder::Reversed || Args.size() == 2);
71927193
// Determine the implicit conversion sequences for each of the
71937194
// arguments.
71947195
for (unsigned ArgIdx = 0; ArgIdx < Args.size(); ++ArgIdx) {

0 commit comments

Comments
 (0)