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

    <tr>
        <th>Summary</th>
        <td>
            Clang doesn't implicitly move in local function declaration decltypes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            c++20,
            clang:frontend
      </td>
    </tr>

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

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

<pre>
    ```
struct X {
    X();
    X(X&&);
    X(const X&) = delete;
};

void f(X x) {
  using T = decltype(throw x, 0); // OK
  void g(decltype((throw x, 0)) n);  // Oops, this should also type-check a move
  void h(int n = decltype(throw x, 0){});  // Oops, this should also type-check a move
}
```
Clang says: https://godbolt.org/z/zMoz7ejxG
```
<source>:10:26: error: call to deleted constructor of 'X'
  void g(decltype((throw x, 0)) n);  // Oops, this should also type-check a move
                         ^
<source>:11:33: error: call to deleted constructor of 'X'
  void h(int n = decltype(throw x, 0){});  // Oops, this should also type-check a move
                                ^
<source>:5:5: note: 'X' has been explicitly marked deleted here
    X(const X&) = delete;
    ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFU0tv2zAM_jXyhWhgS3GcHHxok3aHYdhlh15lmY7VKFIgyV3TXz_KSZo-UQwFNkMPWqQ-8iOpxrX7ms3y48hXLL8M0Q8qwi2w6upwAvTdMj5nfMHEqzOas3G8VSlnQ4SDwQKYWEGLBiM-GbJqdZbH9d7pFroECw_jpXMIQ9B2Db-OOMrE_Q7JMPbe_U7GS8gPQQDjNzTg5_fT1RF1TcbP7r1zlfzZI8QThtuFpI-9DhB6N5gWpAkOEsqF6lFtQMLW3eMLXz2haxvBfhYt0aMcfM1nQjgIL-u4NJISFuQ-MHEJfYy7JBycrF3bOBMnzlNabh7T_OEeK7x7-PYuFhPL4AavqHbXBFLktFBZCRe9dz4JShoD0R1r3MJY_dRJzoPriFxFnVD9j5J88LHy-n1yBS1CfJXcP-2BD0l-wrU8TrAuvcvLExPoZYAG0QI-7IxWOpo9bKXfEPdTDnr0-JcP_mUopxbL2lq0C7GQWSQ_WB8at3UYqPZVBL09h0CMQVswjioC3WBV1M6O2ZVePskpSyEbvKlftb2O_dBMlNvSjzH3p-1i590dqki_OoQBKfc35VRMi6yveTVfcIFC5sWsFGWBVTXtumI6n1alnJWYGdmgCTUrrxjnzUBNzVPpaFOM09kVz58dJW4UT-edjWjbpClXma55znkuioIXXPD5ZF4WeYOzYpELVN2sY9Mct1KbSQo3PdvM12Pk5DCQ0ugQw1kpQ9BrizhGRfhyiL3z9a7XxupNVVXZyLMeSf4BECq3YQ">