rsmith added a comment. How do you defend against attempting an infinite sequence of user-defined conversion? For example:
template<int N> struct X { operator X<N + 1>(); }; X<0> x0 = X<1>(); ================ Comment at: clang/lib/Sema/SemaOverload.cpp:7333 + // Save the bad conversion in the candidate, for later use by diagnostics. + Candidate.Conversions[0].setBad(BadConversionSequence::no_conversion, + From, CallResultType); ---------------- `Conversions[0]` is for the conversion of the object argument to the implicit object parameter. This should be stored in `Candidate.FinalConversion` instead. ================ Comment at: clang/lib/Sema/SemaOverload.cpp:11349 + if (Cand->FailureKind == ovl_fail_bad_final_conversion + && Cand->Conversions[0].isBad()) { + SetAsMultipleUserDefined(Cand->Conversions[0]); ---------------- `&&` goes on the previous line (here and below). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74238/new/ https://reviews.llvm.org/D74238 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits