[clang] [Sema] Fix an out-of-bounds crash when diagnosing bad conversion for a function with a parameter pack. (PR #92721)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 27 02:47:50 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7429950d840b8fec3d9a48d00e612a3240c2be83 4358b43e283cb13dbe4d32fcce3c68b6da15b12a -- clang/lib/Sema/SemaOverload.cpp clang/test/Misc/diag-overload-cand-ranges.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index f9a5032e10..21644dd56b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -11307,7 +11307,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
       ToParamRange = Fn->getParamDecl(I)->getSourceRange();
     else {
       // For the parameter pack case, diagnose on the first pack.
-      for (const auto* ParamDecl : Fn->parameters()) {
+      for (const auto *ParamDecl : Fn->parameters()) {
         if (ParamDecl->isParameterPack()) {
           ToParamRange = ParamDecl->getSourceRange();
           break;

``````````

</details>


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


More information about the cfe-commits mailing list