<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55457>55457</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format gets confused by attributes on enum classes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bsilver8192
</td>
</tr>
</table>
<pre>
This:
```c++
enum class [[nodiscard]] C2 {
// a comment
A,
// a comment
B
};
```
turns into this:
```c++
enum class [[nodiscard]] C2{// a comment
A,
// a comment
B};
```
Also, this:
```c++
enum class [[nodiscard]] X2 {
A,
B,
};
```
turns into this:
```c++
enum class [[nodiscard]] X2{
A,
B,
};
```
The same `enum class`es without the `[[nodiscard]]` just get reindented to 4 spaces and are otherwise left as-is like I expect.
Tested with clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04 with all default formatting options.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9kk1v3CAQhn8NvoxsYWyvvQcfdhNV6j2H3CpssJcUw4qBfPz7jr1pk1RNP6SoaGQzA8w8L8Pg1VN_czLIqgPj14wf2I5fbGTiuNoW1S4tMFqJCKw5kjmvDI4yKNZck8GVANY-bwZg4hMZSBj9smgXv8cPTFz9ac9zEtZes-r4E9PFjSk4BOOih_gh6Cv5OzTvj9da3h__nvf4G-WX78Gip-IfIv72Td9eazr-mP-_VtyKVzA_X_FfAV2-NycNKBcNFH8pujoIDyaefIrEuy3_EoTicJcwwqwjBG2cotZpBSSzBjzLkfJIp0AGDZ4ShQeDGqyeIkjMDYI1XzV8Bv141mMs3qBpXDOtFCuVm-l2rL1f8rIueMHzx273ZVfn1rj0mM8u5WlILqa87ApeX45Ja0HpSSYbYfJhkTEaN4M_R-MdFpnqK7Wv9jKLJlrdb1Xyy8ZVENJbdFNCohiegA4HM6RIiryDl8vSmKVg-1OM562t2zueqXwaCnrL5KzUz7_8HPwdKSXXICaNNGmaummzU1_uWjVVjWyEmtquGZqOS9XWIxd639aVyKwctMV-bYQQTj_AloLm1IjM9IILwZuy5l2zr3jRyrFsdmo3leNedlPLaq4XaWyxchQ-zFnoN6QhzUiL1mDEl0VSZman9VaO8stEryH0Axp7r0NX7kW2le83_G9j321c">