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

    <tr>
        <th>Summary</th>
        <td>
            [C++] NRVO doesn't elide move when return type is a placeholder in a function template
        </td>
    </tr>

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

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

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

<pre>
    Looking at the assembly output for this <https://godbolt.org/z/6eG7TWvvd>:

```c++
struct test {
 test();
    test(test&&);
};

auto f1() {
    test t;
 return t;
}

template<typename = void>
auto f2() {
    test t;
    return t;
}

template<typename = void>
test f3() {
 test t;
    return t;
}

template auto f2();
template test f3();
```

Shows that the move is elided in `f1` and `f3`, but not in `f2`. This also happens if the placeholder is `decltype(auto)`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysk82O2zgMx5-GvhATyHT8kYMPM8lmL7st0A7as2zTsTqyZFh0BunTF3aSSaa9FGgBQbIo-keR1F-HYA6OuYT0CdJdpCfp_Fj-b0Tbx9D5l6jyzan8z_sX4w6oBaVj1CFwX9kT-kmGSbD1I0pnAkKy7USGAMkj0B5of_BN5a2s_HgA2n8H2mf8b_789XhsIPlndlM7UNc5U-dRAz3NY7EGGadaUDgIQn4xLlugAmgDydWGeDWfl2wZNwfId7fvZdaTeGzjM-iOfiGh3OAjyzS6O8tMu0MJ94PVwpBs5TSw0z0jJDs8erOkehePfice4t8JuXDb5JeQfxAP36Xx5v12_C7kDXbt7j3yc-dfA0p3eVi9PzKagGxNww0ah5CpNoZMoXbNsklmAm2xmgSdl6sPQaZW-Dw_Qm2Dx04PA7uApl3Ag9U1d942PM58yFTDtZ2rBlTM6cw3zVTUlEmzSTY64jLO44LiVBVZ1JVpynHOpJNNW2zqVq2zPE1jHVdFmyRpoSNTkqK1ymKK87RQ2Sqt1uu02TAVRZzleQ1rxb02dmXtsZ_1EJkQJi43KRUqsrpiGxYVEjl-xeUQiGZRjuX8z0M1HQKslTVBwo0iRuwi3-1FNOkOP3z68hEbz8EB5XKu5rm2rx27tz6fhqXY-n11HGpsJ1eL8Q6vPY2m0ZY_SdtIN1Wr2vdA-_k6l-VhGP03rgVovyQRgPbnJI8l_QgAAP__COVLQQ">