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

    <tr>
        <th>Summary</th>
        <td>
            [Clang][Frontend] Clang allows wrong usage of `ownership_returns`.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Clang does not report an error for obviously wrong usage of `ownership_returns` attribute. 

`void foo(void) __attribute__((ownership_returns(foo)));`

In above example, function returns nothing, so `ownership_returns` does not make any sense.

Example on godbolt (trunk): https://godbolt.org/z/xsGaE6e8r
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMkt1unDAQhZ9muBkFmeFn4YKLJBuqPsXKwMC68XqQbTZJn76CXaVRq0qVLNuSx-fMGX06BDM75hbKJyiPiV7jWXy7hFc_6znpZfxon612M47CAZ1E9LyIj6gdsvficRKP0l-NrMF-4JsXN-Ma9MwoE0Kl5M2xD2eznDzH1bsAlUIdozf9GjlFUEdQj_e9UlcxI04iQPV2BWrwdPosP52AaqD6b1Gq90_NfeVPUKmv0t8d6l6ujPyuL4tloGecVjdEIw7vIlu-s3Hz9hbkn81_juKiXxm1-8DALnD61e7l5oLicJaxFxsRqI5-da97e494jnEJkD8CdUDdvSgVPwN1P4G69_BNv1Rc-2Rs87HJG51wmx0oy7M8PxySczs0Va_LUjcVDfVUV6M6NNM0Dk2eFwVPWWJaUlSoQ1ZnRV5lRVr0_TBlU6XHgrmZKigUX7SxqbXXy-admBBWbpumVFlidc827GgQDRsFQLRR4tut_qFf5wCFsibE8Fshmmh3nnZuoDxC-dR5cZHdCOURbzhpa-Ut_CcuabJ62_4xMBPPa58OcgHqNvP78bB4-cFDBOr2LAGou8W5tvQrAAD__-IR9Dw">