<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61660>61660</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang suggests wrong attribute placement for enum classes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tbaederr
</td>
</tr>
</table>
<pre>
Consider this code:
```c++
__attribute__((deprecated))
enum class F {
Foo,
Bar
};
```
clang suggests:
```console
<source>:3:16: warning: attribute 'deprecated' is ignored, place it after "enum" to apply attribute to type declaration [-Wignored-attributes]
__attribute__((deprecated))
```
Godbolt: https://godbolt.org/z/E4vT1dc57
But placing them after "enum" is wrong, too:
```console
<source>:4:6: error: an attribute list cannot appear here
enum __attribute__((deprecated)) class F {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Godbolt: https://godbolt.org/z/PWvd8jsr5
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk81u2zAMx5-GvhAJbCm2k4MP-ah33WFAj4Es0Y4KRQokukV32LMPdrM269ZhwwIhtiSa5P9HUqVkB0_UQLmD8pCpkU8hNtwpMhRj1gXz3OyDT9ZQRD7ZhDoYArmF_AD5j_8qf1kaxG5a8-nxqJij7Uam4xHEGsTa0CWSVkwGxGZasyH58YyonUoJW4T6-j22IYDYXze4U_EarT6A3L2LfJuOdsoPmMZhoMTpLdfXLINPwdH1VO5TGKMmkHcgtxLktqhAbvFJRW_9ML2-6kAQ9a2GGm1CO_gQp90eL05pQsuoeqaIIMSkDYRADqguF_d844sD8vOF0JB2Kiq2wSOUu8X91eHi1TRBefhHpu_AfAqmC44nMSfmywxFtCDa4eViGeIAov0Kor1bPX4pjC7rW6S7kWdx1g_IJzr_KtAmfIrBDxMGDuHDDvkD-xXI7YyeYgxxBu9veDmbGLXyPvDEklTEE0W66aG_oPObNoPy7tuHv_-l-fn-0awfUiwz00izkRuVUVNU9aZc16t8lZ2aThlTma7ue9Kmqo3QpHvT92pdymLTy8w2Ihcyl0IWVS7Fall2hVaFFNW6yNeqr2CV01lZt3Tu8TzFzmxKIzVVUVV55lRHLs0DLsQQgsHexsQ424AQ04gJMc8MyK2xavAhsdVpuisPWWwmt4tuHBKs8qkI6S0QW3bU7H8auJc-uCncPBVn8ox9iDhXaq4CpWyMrnmH0PJp7JY6nEG0U5zrY3GJ4YE0g2jnzBOIdhb4PQAA___k43oe">