================ @@ -8955,6 +8962,22 @@ class BuiltinOperatorOverloadBuilder { (S.Context.getAuxTargetInfo() && S.Context.getAuxTargetInfo()->hasInt128Type())) ArithmeticTypes.push_back(S.Context.UnsignedInt128Ty); + + /// _BitInt overloads are a bit special. We don't want to add candidates + /// for the entire family of _BitInt types, so instead we only add + /// candidates for the unique, unqualified _BitInt types present in the + /// candidate type set. The candidate set already handled ensuring the type + /// is unqualified and canonical, but because we're adding from N different + /// sets, we need to do some extra work to unique things. Copy the + /// candidates into a unique set, then copy from that set into the list of + /// arithmetic types. + llvm::SmallSetVector<CanQualType, 2> BitIntCandidates; + llvm::for_each(CandidateTypes, [&BitIntCandidates]( + BuiltinCandidateTypeSet &Candidate) { + for (QualType BitTy : Candidate.bitint_types()) + BitIntCandidates.insert(CanQualType::CreateUnsafe(BitTy)); + }); + llvm::copy(BitIntCandidates, std::back_inserter(ArithmeticTypes)); ---------------- erichkeane wrote:
I'm concerned about the assert on `9001`. It seems to me that this changes us from being a reasonably 'fixed' list to having a perhaps-unlimited list. I think that the intent of that assert is nice (ensuring we can small-vector-opt this list), but this section here makes that no longer guaranteed, right? The `ArithmeticTypesCap` is 24, and we do a `push_back` of 23 other types (by my count!). So adding TWO bit-int types + having all the rest of the types enabled causes that assert to fire. https://github.com/llvm/llvm-project/pull/84755 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits