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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] `_Nonnull` attribute on return value isn't propagated from declaration to definition
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    Reproduce: https://gcc.godbolt.org/z/7q3Kd55f6

I would expect a warning saying that definition doesn't match declaration or a warning on returning null on a `_Nonnull` return type.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxckdFu3CwQhZ8G36BYNjYmvuBi_0SWflXqRV-gGmDWpmXBhSHp9ukrb1dNmqvRzHCOmO9AKX6NiJrJ_5h8bqDSlrI22dvvEbNpTHJX_QX3nFy1yIYT34j2woYTEwsTy2ptuyZnUqA25ZWJ5RcTi_oxfHJSnifWnVh3-p-_phocx587WuLAXyFHH1de4HoU2oC4w7OPnnyK3CUskQlF_AJkN-7QBshw26X8Tp8iz0j1TxNrCMcEOJu6r59TPAZs6u5POF13bBunBzcPMzSoeyV7KcWjHJtNz4BmwFmNIPqxd6gQbC8BOgRl5kk1XotOyE51Qz8KJVTb9-dJmXk2bprsNDyyscML-NCG8HI5YDS-lIq6H6e5G5sABkO5gRbCBogrE4KJp7_dcHIe1pgKeVuOnXxusj7MHkxdCxu74AuVN3vyFG7JPd308vnj4UCUvamEb6D4C4SK3N_57jntsAKh4-ecLv-QpvQuk6bmoD9E72mrprXpwsRyfOpeHvacvqElJpYbgMLEcmfwosXvAAAA__-Eu84P">