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

    <tr>
        <th>Summary</th>
        <td>
            -Wdangling-gsl only diagnoses first template argument
        </td>
    </tr>

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

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

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

<pre>
    We just ran into a bug where we have a gsl::Owner type which holds two values. We found that the `-Wdangling-gsl` warning correctly detects unsafe conversions such as `string` -> `string_view`, but only for the type which is listed first in the template arguments.

Simplified example: https://godbolt.org/z/Y56eWv74Y

Walking through the code, it seems that this is because [this line](https://github.com/llvm/llvm-project/blob/54d544b83141dc0b20727673f68793728ed54793/clang/lib/Sema/CheckExprLifetime.cpp#L318) only checks the first template argument, rather than all of them. Is there a reason why? Intuitively, it seems that we should be checking if _any_ of the types are pointer-like. Does that introduce false positives?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUUz2P3DYQ_TXcZnALifouVKx9FmDkgBQuFq4OFDkS6aNIgUOtvPn1AbVnOImRwpUAaubNm_feCCIzO8SeVR9Y9XwSW9Q-9M9_vHjU4TR6de-vCN82ihCEA-OiBwHjNsOuMSDsCFrcEATMZFlxYcXlz91hgHhfEXZtpAbtrSKIu4ebsBvSGa4Ik9-cgqhFhKgRWJ09XZVwszVufkpYdQa7CM64GaQPAWW0d1AYUUaCzZGYEKR3NwxkvCOgTWoQlJAoBuPmhPDEik8_X15vBndWZ4x_hHGL4J29w-TDweAfhA2BNRRRwWQCRTDuUYHLakVEEGHeFnSRziy7sOzyxSyrNZNBBfhdLKtFVlxAx7hSkoQPjA-zV6O38ezDzPjwF-PD16rG660pvz5ArsK-pWWjDn6b9TFReoWJrIlAiAv90MtQ4jiiFBshsOrD8WSNQ1Y9M97-Z7SJehvP0i-MD9befnye1uC_oYyMD6P1I-NDVaqqLMe2yMtcyWzkWcObuimmum26ouEtqqpsuoLxQVrh0ibWpMYvuAjGh48a5dun72t4MRNGs-BZrivjxUuRt4x3D8FlKqJjv4e8v-iaVg4i6hQjLRwIa8FPqWM5w-ejNaTIBRTkHez6zooBPru4mWhuaO-_arYjkPabVTDig0HS2kzwKtz99R39yACBCAirNy5ieLLmDc_w7PEdx7gYvNokwiQspTo6ZhIrhpPqC9UVnThhnzdll1W8qflJ95ksCt5NVZ7lmSo7XtW1KqSsOtXWWZXXJ9PzjFdZnZV5VXWcnztVp7omr6a2bSVnZYaLMPacfEsZOhmiDfu85G2Wn6wY0dJxxJw73OH4yzhPNx36w-xxm4mVWQo2_YSJJlrs_316D5uUEbPzhPR_Lp22YPvfTtrBjBgf3qnfev53AAAA__-oPYJG">