diff --git a/clang/lib/APINotes/APINotesReader.cpp b/clang/lib/APINotes/APINotesReader.cpp index fa06dffdd14b0..646eabd2a5ecd 100644 --- a/clang/lib/APINotes/APINotesReader.cpp +++ b/clang/lib/APINotes/APINotesReader.cpp @@ -2045,7 +2045,12 @@ APINotesReader::VersionedInfo::VersionedInfo( Results.begin(), Results.end(), [](const std::pair &left, const std::pair &right) -> bool { - assert(left.first != right.first && "two entries for the same version"); + // The comparison function should be reflective, and with expensive + // checks we can get callbacks basically checking that lambda(a,a) is + // false. We could still check that we do not find equal elements when + // left!=right. + assert((&left == &right || left.first != right.first) && + "two entries for the same version"); return left.first < right.first; }));