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

    <tr>
        <th>Summary</th>
        <td>
            [clang][c++] Why anonymous struct definition inside instance creation expression not allowed in Clang?
        </td>
    </tr>

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

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

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

<pre>
    Here is an example which is compiles with GCC but not with Clang.
```
#include <iostream>
auto&& f = []() {
    return ((struct {
        int a = 0;
        void increase() { this->a += 1; }
    }){});
};

int main() {
    auto&& some = f();
    std::cout << some.a;
    some.increase();
    std::cout << some.a;
}
```
(https://godbolt.org/z/bsnGh3zvc) 

Why this is important ? I came from javascript/typescript world where almost all software built using passing objects between functions. It's a very useful feature and can be proven objectively - one of the hardest problems in computers is well-known the "Naming Things" problem and having ability to declare anonymous struct inline (inside instance creation expression) we do not have to name type and instance variable and so do not have "naming thing" problem.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVEtzmzAQ_jX4smMGCxzbBw6J06S59NSZngUsRqmQGElAnF_fXZGXkx5aj4y00j6-b7Wryjbn8js6BOVBGsAn2Q8aYe5U3fFebftBafQwq9DB_fEI1RjA2LBsHLU0pzTJbpPsOrnKXsYiilyZWo8NQpIflfXBoeyT_NtyLMdgE3FFA1pSuIVke5NsbxOxT8QBkt3Nogb0cxhGZyAe7cnNWIdLBf4pE0BGR1mSfzqbrGpIoSYAHt8jQOiUXxMishM3bLohUzq5fTdnQRw42rJ4dc3i2zp-GUAvlfkbgw9kve0xwmwXxQuwPjRJfk2jtpRlShuNaJHKSz3euiT0337eaH65t30XwuDZgbijcbJNZXVIrTuR9Ez_ypv7Ln-e6kj0Qw5-deeYVK4c1Q_WBWk4_h08QC2JeOtsD49ykr52agjkK5wHXASYrdMNlR6Xo9Q9VQxNmnC3YZa0V41KBxi9MicYpI-zrR6xDh4qDDOigXY0dVDW-BQeyP2OqhomdGcyw3bU0KKkYiL_piFEhuxgcHYiy8WTmlCfYQ3WINiWyCB00jVIWEiv0tgTMxPbYgzoItMZtV7_NnY2UT8R4ofsGdzPjr6e5FfbGLaTEx_KSmkVKF8WGqy1jKCsOfd29PBS5cpoZdjjXhmvqJNoopTWCHz1zJM6dnBIubCGL2NGaGxsT4qC7Ntw2jnJMfab_SSdkgQp7np7YUWAzUIgMIEP-NNVU-bNIT_IVVBBY0lNW_MTwJ1LS24jwW0MXAlf6DTYKqMi7H_gEwFRAdgZGfjy1lAtrUany08lSm_RWKV0KyRoPb1Oa8LNt0qi8n5Euou7bbET-aori902F1dbgRuxa_a7Qgi5yTaZyPdFvWvb_UrLCrVnipwQnCG6oDXxW6lSZEJkRSY2-6Io8lQK8iaqKt8eNrgr2qTIkJ4DnTIO7p2VKyOkaqSSKDKtfPDvh1zOJ4Mxo-yfXozOurI6madVjFtG3H8Anf3GSQ">