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

    <tr>
        <th>Summary</th>
        <td>
            support AUTOSAR C++14 A7-5-1 bugprone-return-const-ref-from-parameter
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy,
            check-request
      </td>
    </tr>

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

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

<pre>
    > AUTOSAR C++14 A7-5-1 
> A function shall not return a reference or a pointer to a parameter that is passed by reference to const.

[example](https://godbolt.org/z/9zMEco9E3)

```c++
struct S {
    S();
    S(S const&);
    ~S();
};

S const& f(S const &a) { return a; }


S f() {
    S const & a = f(S{}); // object referenced by 'a' has destructed after this statement
    return a; // bugprone
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U0GPmzwQ_TXDZURkBghw4JBsFn2XT5Wa9gcYGAKtwdQ2VXcP_e0VOF12I1VCBg-eN2_e80hrh9vEXEJ6hvQSyMX12pT_sTFPchCFyIJaty8lxM94-vrl0_X0GZ-AzkDnKMFTFqZhhCAuIE7bEeyWqXGDntD2UimctEPDbjETSjTcseGpYdQGJc56mBwbdHrdSCNH3ra9dDhYnKW13GL98i7PaWz0ZN3hXtKv6Zl_yXFWDOkFKO-dmy3EJ6AKqLrpttbKHbS5AVWvQFXx-v9zo4vnGKj4gHMU_ml8gz5qnVkah1eE7B5BRLwC5Wt6_BC7en5Ax8e_vx9TILvs39u6J2O3YyHQUQIVK4E3LSE-4wrwnv4do_N1HvjuWCgR4ouvsJ7JLp4Ver1Q19-4cbvomwVAmQTKsJcWW_aacIuy844NFq2Tjkee3F70A1kPXi-32eiJdwk-Sh-0ZdwWcSEDLqMsEkkcRXkS9GVxlF3ScZrLNhWCi7yL8izKIimOMsuFCIaSBCUijpIoTY6UHNokKepjlNZJGxVZm0IieJSDOij1c1yvQzBYu3CZp5TGgZI1K7uNAVGj5HQL3dC-ABHQ0xrqufkeGv6x8OoQrcNiyhUqrJebhUSowTq7g7vBKS7tMs_auH_Pzl9BQi9WuNkUGu7CzugxfBuLYDGqfLjZg-uX-tDoEaha695f4Wz0aiFQtXVogaqtyT8BAAD__8ZYIvU">