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

    <tr>
        <th>Summary</th>
        <td>
            Clang does not detect use-after-return in reference-type fields init
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
struct MyThing {
    const std::string& s;
};

MyThing makeThing(std::string s) {
    return MyThing(s);
}
```
https://godbolt.org/z/6335YcKMM

Obviously this also doesn't work `gsl::Pointer` types like `string_view` instead of `const std::string&`.

This is different from https://github.com/llvm/llvm-project/issues/58985. This still only needs stmt-local analysis and has probably a simple fix.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycUs1u8zgMfBr6QiSQ5fjv4EPbIJdFsXvoZU8L2aIdbRUpEOm02adf2GnQH-C7fIBh0yI1nOHQMLspEHVQPkK5z8wsx5i6md_bMuujvXZQqdsznM-g9qAeWNI8CD5fX44uTAj14-0cEXGIgQVZLBQPUCylLkygK2QoPsqg3n_G6_uOdDKvtEagmx8QyKDb760SyZzCncZyBXT7rcstuPO__R5Fzrwg6wPowxRtH71sY5pAH_4DfaiKovx7-OP5-SvBP_uLizP7K8rRMRrPEW0kDqBrwbeYXhEqNbG_Uf4ruiCUoFIo1zMxevdKS8VNyz8XR29L0gUWMhbjuCR_NTqo1PYrmZeFgmO0bhwpURAcUzzhD2FOjnO_HeIJ9MH7y_2zOaf4Lw0C-uCYZ2LQh7Jpm3KLKy6L8x5j8FcMRHY5OMnGx8F4NMH4Ky_6g8WjYTyn2JveX9Egu9PZE47ufZvZrrBt0ZqMurzWuil3uVLZsat2VamHphnrJq_avsrHqjV6VIUd88bs8sx1WumdalSZq6JUalvWVVvn7VjkympVN7BTdDLObxcpi2nZKqLLVd6WdeZNT57XVdZ68CZMUDyMKQahYEFr0E9fEtaZKUQWN_CSK_dZ6tYR9fPEsFPesfBnJ3HiqXtaLq_eY4iCloQGwZlpY0ahtPlYShcw0erOQJtlB3B05C2jC06yOfnu9-36EHvp9P8BAAD__-r0KcM">