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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Trailing return type with type identifer mangles swith case statement
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

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

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

<pre>
    Given this input:

```cpp
enum class FooThings : int { Foo, Bar, Baz };

static FooThings ReturnFoo(int arg) {
  switch (arg) {
  case 0:
    break;
  default:
    break;
  }
  return FooThings::Baz;
}
```

clang-format seems happy with the state of the formatting. However, when you switch to using a trailing return type for the `ReturnFoo` function:

```cpp
enum class FooThings : int { Foo, Bar, Baz };

static auto ReturnFoo(int arg) -> enum FooThings {
 switch (arg) {
  case 0:
    break;
  default:
    break;
 }
  return FooThings::Baz;
}
```

clang-format seems to get really tripped up:

```cpp
enum class FooThings : int { Foo, Bar, Baz };

static auto ReturnFoo(int arg) -> enum FooThings {
  switch (arg){case 0 : break; default : break;}
return FooThings::Baz;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUlE2P2ywQxz8NvowSEfwS5-BD8uRJe65W6hnbY5sWgwXDRtlPXxlvXlbb9lBpK1WKAsbMn__8xoz0XvUGsWL5geXHRAYarKu-Kq33lzapbXupPqlnNECD8qDMFIile8aPjF__C778mmlaVtCEERotvYeTtU-DMr0Hlu5BGQK2PcyrTPwHB-mW4QXY9sjSw6OsJ0mqeRD4ghSciaHlLCRdz8Ru1lsCAPxZUTMAE-X7d430CPxmHQCgdii_304FaLGTQdNv98w-X6cu-rkbnOPS_UG-3BO5br4hekyw0dL0q866URJ4xNHDIKfpAmdFA9CAMCNAsF18WDaSMv0aPtszPmOEdx7QwMWGa_JkIXhlepBATio9T1-d0mWKMlGOFfwOtODQBdOQsuavFlcGsr-q64ql_0M87OGYWz0_vtQfW2my0COBQ6n1BcipacIWwvSP4H_Hn20PC_bo5YryyvnN4o3Vn2BN2iptd-lOJlhttrwocp6XWTJU7abI8hrbZoflZlvjTmRF2m1kvWvyVNZdoirBRcY3KRebtBDZuuw2dZ3nZSuxlGVXsIzjKJVea_08rq3rE-V9wKrkvBCJljVqH9ukEI8FZULMjdNVc9iqDr1nGdfKk78LkSIdW-ybwPwITz-7osv9n2eqRUOqQwejNL1GH7kPyxceu8OIhpLgdDUQTZGgODFx6hUNoV43dmTiNNt4HVaTs9-wISZOMTnPxCnm9yMAAP__b5bMfA">