<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJylVEuP2jAQ_jXhMiIKDiHlkMPCFqnnVmpv1cQewK2JI9sp5d93JrALbHdbqUUm8fiV7zHj1ptT82lPsPXO-aPtdqC9IbCR3yGQTu4Egb5xh0xWPmTFY1Y8ZIvi3HSmVtLG0ZjCoBN8gaxeZfUjZNWK2wFPLX0duiHyAdWjtHL14phzuBoSJIZiLO46H5PVETAQRH-g4x4TI-pSQGN18uH0O5hLWK5jMrbLyve8ZCb_ih9AIfggnUzVd5hUDZhSsO2QCDR2nU_QEmDfO0sGkod06in-I0e4-2XV-z-jPGLo2ATpXkG9gpj9sSxSkGgNvUPNniXAbaLA69UZJ3cEv1A53Zx3oQSGtMOAyfpOiEw_X46cPi-NQuU1lSVlRkUjRDzF0bfrBxidqDhKqLF1dFWR0craC8-nzWyucJCRK4tFcWGxKOCA3ymOc2foz9_K4UNniGX4e2K-5dWzm28lJtNBrannEoCjTXvPiTqSz-Gjh57CHvuzBOOo0D8GLy5uQISKCTuDwQC66AUG_RRhrNQWStmNMqt3-5T6KHmtNtyIXG5ZsM2FiwmsC4dGu1zo50_ZUKpMLV84II4qNVbTjcl-y_pxGKOgYFDC_qyooe20wwNJyuCBwYPn3SHmF0XG53oN2bx4QCa3YuAH7PKJaUqzLJc4wYGVCQ3KbD9o3pwmQ3DNPasd6ze0ufYHDpz78fSa9sHLLcOhjXGQTNlU5byYT_ZNvVTberlcLLCat2VZmFJvVTuvVVXPyWxnE4ctudiIwUoxv7GAtowjEXNUimlO_h-IbVShVDFT1ayqZqrOsWqLWheLGc2VbheataEDWpfLObkPu0loxiPbYRd50tmY4nWSbeCCIxpxM8LECUHN-vaSu7sLj3vqoB9SkjJ5M5nPxcM3t-eEuzF_MrJpRiq_AI_s5hI>53404</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Contradictory diagnostics when putting [[maybe_unused]] after record declaration
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aaronpuchert
</td>
</tr>
</table>
<pre>
The following code is correctly rejected:
```c++
struct X {} [[maybe_unused]];
```
But the diagnostics are somewhat contradictory:
```
<stdin>:1:15: error: 'maybe_unused' attribute cannot be applied to types
struct X {} [[maybe_unused]];
^
<stdin>:1:15: warning: attribute 'maybe_unused' is ignored, place it after "struct" to apply attribute to type declaration [-Wignored-attributes]
```
The errors says the attribute is not applicable to types, the warning says that placing it after `struct` makes it a type attribute. Indeed
```c++
struct [[maybe_unused]] X {};
```
is accepted without error. So perhaps the error is wrong? The standard also [explicitly allows](https://eel.is/c++draft/dcl.attr.unused#2) the attribute on "the declaration of a class [and] a typedef-name" among others.
CC @AaronBallman.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVM2OmzAQfhq4WEHEQGgOHDbZjdRzK7W3arCHxK3ByDZN8_adIdlNst1tpSIDHtvY388MrdOn5vMBReesdUcz7IVyGoUJ9PYeVbQn4fE7dVAnxUOSPyb5Q7LKz00lcsNtHg3RTyqKryKpN0n9KJJqQ62HU4vfpmEKtEH1yK3YvNrmHG6mKCJB0Qb2gwvRqCDAowiux-MBIiEaogdtVHT-9CeYS1hsQ9RmSIonWrLku6KHQO-d504i6ztMshYQozftFFEoGAYXRYsCxtEa1CI6EU8jhv_kKO6upHr6O8oj-IFM4O4V1BuIyR9DInmOtmK0oMizKKCL6Gm9POOkDuNnKqeb_S6UhEZlwUM0bmAiiy-XLRcvSwNTeUtlTplZ0SACnMLs2_UAQscqzhIqaC1eVSS0vPbC8_ljMpc58MiVxSq_sFjloocfGOa5M_SXszLxcdBIMvw7Md_z6sXN9xKT6IBSOFIJiKOJB0eJOpPPxCcnRvQHGM8SzKNM_-gdu7gTLFSIMGjwWoANjmHgLxbGcG0Bl90ss_xwiHEMnNdyRw3RZoYE2124aE-6UKiVzZh-9pwNhUzk-pUD7KiUczXdmOw60o_CEBgFgWL2Z0U1dosBeuSUgZ7AC0df-5BdFJmf261IyvwBiNyGgPcwZKluCr0u1pBG4oPN9rZG70r5eMBBjFOM7PK7Xpy9px-PI71usKeTt829QHuyYmoz5XoKrP35_FqM3vEPi0ITwsRJt6uKMi_TQ5OXUH5ou64uoCyWq7pct3nZrVtV5N2662RqoUUbGsYnJZ0-12JHhCOSXFISxtQ0MpcyX8pqWVVLWWdQtXmt8tUSS6nalSKRsAdjM4aTOb9PfTMja6d9oElrQgzXSfKDKg9xPpX2h4lyzDfAOo-TIhtiOjNpZhq_ARKa0Pk">