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

    <tr>
        <th>Summary</th>
        <td>
            Misleading diagnostic for `-> struct {} {}` class definitions in trailing return types
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
auto foo() -> struct {} {}
```
https://godbolt.org/z/zqne175PE

### Actual Diagnostic
```none
<source>:1:15: error: declaration of anonymous struct must be a definition
    1 | auto foo() -> struct {} {}
      | ^
<source>:1:27: error: expected a type
    1 | auto foo() -> struct {} {}
      |                           ^
<source>:1:27: error: expected function body after function declarator
```
The first line of this error is misleading because `struct {}` is a class definition. However, a *class-specifier* cannot appear in this context, so clang appears to parse the first `{}` as the function body and `struct` as an elaborated-type-specifier or something.

### Expected Diagnostic
```none
<source>:1:15: error: class definition may not appear in a trailing return type
    1 | auto foo() -> struct {} {}
 |               ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMuS6yYQ_Rq06bJLQpJlL7TwnbErm1RlkR9oQUsmhUCh0cydfH0KyTOO57HIraHAWNANp08fGpnN4IhaUf8Q9WOGc7z40J4Mk3vGJ8o6r19ascvXrqZJ5I8iP-IcPfTeC7kX8gAbUZ6AY5hVBNH8EM3jdVqt3_zXz0uME4vyKORZyPPgdedt3PowCHn-J42_HRVN_cfp6r3-ynLtcFRxRguPBgfnORr17hLnHV2Xygf2c1AkypMoj0UatSiPQCH4kP5oUhYDRuMd-B7Qefcy-plfgxlnjtARIGjqjTPJcD0bAKAA0TzA_-MClpb8RH36EqZs7mDSz4lUJA0I8WWi70LwdfsVbP3s1EJk0gxgHync1l6J9uFTSfx5IehN4AjWOEqpiBfD6yVgGEbDllAbN0BHCmcmELv8Lkaxy5MlgrLI_J98beE3_0xPFIR8AAQhj4vFhidSpjdp_QgKnfMRcJoIAxi33q-8i_QzJkf26WA3XE0YoocJAxPEN-wpnDcsyOvOPStO34BfrdABWex8wEh6k_J7gwY-APuR4sW4Yfv5ezi9JuBbXsR79mDEF7inBiEGNDYlI1Ccg_sOUX7U402Dr3Fkui31oTxgRm3R5FW5q3a1zC6tkkrKgrDpKlmqrsg7td-X2OmqUoh6n5lW5rLKi7wq8rIp5bav97ouDro4NF2NuhNVTiMau7X2aUy1KDPMM7XN7lA2mcWOLC9FUkpHz7BsCilTzQxt8tl088Ciyq3hyLdToomW2t9v8tVvSYLehySGr5nZ5R_SwYs2P6GfsznY9l1pNfEyd1vlRyHPCdJ12kzB_0UqCnleAmEhz0ug_wYAAP__p4LQDw">