[clang] [clang][Sema] Fix crash when diagnosing candidates with parameter packs (PR #93079)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 06:28:24 PDT 2024


================
@@ -11298,8 +11298,9 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
   Expr *FromExpr = Conv.Bad.FromExpr;
   QualType FromTy = Conv.Bad.getFromType();
   QualType ToTy = Conv.Bad.getToType();
-  SourceRange ToParamRange =
-      !isObjectArgument ? Fn->getParamDecl(I)->getSourceRange() : SourceRange();
+  SourceRange ToParamRange;
+  if (!isObjectArgument && I < Fn->getNumParams())
+    ToParamRange = Fn->getParamDecl(I)->getSourceRange();
----------------
mizvekov wrote:

Okay. Should'nt be a problem to pipe in the specialization, but as I said, just leaving the FIXME is fine.

https://github.com/llvm/llvm-project/pull/93079


More information about the cfe-commits mailing list