<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/135086>135086</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            1 - ArgIdx in Sema::AddOverloadCandidate looks like it overflows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            shafik
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          shafik
      </td>
    </tr>
</table>

<pre>
    Static analysis flagged the `1 - ArgIdx` as possibly leading to overflow:

https://github.com/llvm/llvm-project/blob/f75dce43ea0a98c0ade916cf3ffcc7548f569821/clang/lib/Sema/SemaOverload.cpp#L7196

Looking at somewhat related code maybe it was meant to be `Args.size() - 1 - ArgIdx`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUkcuK4zwQhZ9G3hRtZF18WWiR_x8MAw2z6CcoSWVbE8UKlpJM5ukHpxOaWQ4ICknU4ZzvYM5hXokM0_8xIfKCUzgyIZj-VuGlLGkzn2-VTf5uPgqW4ABXjPccMkwR55k8lIWAtbyBNzhs83f_i7UcMMM55RxsvEMk9GGdoSRIV9qmmG5MHhjfz1LKOe83MTIxzqEsF1u7dGJijPH6Gm_nLf0kV5gYbUyWiXHqtHekJCHHoXccPQ1N6yY5Tc51WvWTbodeNEyMLuI670JhX_ygEz7HjyttMaGv3fnMhHzvmqH9dPWe0nF3jAVyOtFtwQIbRSzkwSVPcMK7JQgFbpjhRLiWPZ19gDhsc65z-E1M9EwM8AZ_oakrb6Qf5IAVmaZTSkiltaoWo0hKISU5pazsLPai64k3vW181_NBVMEILjRXfBCN1FrVTeN733PSrbOq7SRTnE4YYr1Dq9M2VyHnC5lGat63VURLMT_rXukGj99n45t5kLaXOTPFY8glf8mUUCKZrxwQVniQlAcmDwfvXyz_x9UHj4UgpnTMEMPxwelVfK4uWzT_3PrDaGZifCa5GvEnAAD__xOi3po">