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

    <tr>
        <th>Summary</th>
        <td>
            _Alignas on a struct declaration gives a low-quality diagnostic
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            good first issue,
            c11,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    ```
_Alignas(int) struct T {
  int i;
};
```
gives the diagnostic:  `warning: attribute '_Alignas' is ignored, place it after "struct" to apply attribute to type declaration` which seems like a really helpful message at first glance. However, C does not allow you to put an `_Alignas` specifier on the struct type itself. So following that advice:
```
struct _Alignas(int) T {
  int i;
};
```
gives: `error: declaration of anonymous struct must be a definition` and `warning: declaration does not declare anything`.

The original diagnostic should say the attribute is ignored without the helpful message about placement (which is correct for C++).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylU02TmzAM_TVw0SxDTIDkwGE_Zqf37r0jjAC3xqa2SYZ_X5kkm_Tj1hkPWJYs6b0nt7Zbm6TKryt_S_Lnb89aDQZ9Ig7KhEQcwQe3yAAfkNQvlxgAdoFKiqud1G_3_e_pBnUiD2Ek6BQOxvqgZFJwBo44ozPKDNHEEJxql0CQiPreQg3KA--toy4RrzBrlAQqAPaBHMeKS3O8gWAB51mvD7n4KKwzlyap0WFQ1nBZOI9KjuCJJg9a_SBAcISar46k537RMJH3OLAjQK-cDzBoNJIy-GLPdCIXe3mFzjI0Y7kbre0ZVrvEivPCBybi-8TBNf1MUvWKm7Zmo-PK6tafCp50n8FXC72NuZgVDuLq2J2UJGbon-Rec_wt2X9oFdXgE3LOurh_4A5sz8isWSe7-BuAaWF62shhR70y6kYymu4PjR8zfVJ3OeTrZg1jDKzy7Nrc9v1gqqxTgzKoH0YI_GgX3YHHdWPzrvl9YOCsAkeFLeAvZdvo2eZpIiaIubuMBd-X1jliaL118JqIl20ds5SaXVVVh7zKy2PaNUV3LI6YBhU0NTcNorx44-YR8eUhILC6Tz8X1CqsD3jSxelmDGGO_CfindfA3S9tJu3Ehtan2-9pdvY7xZl_V94vrJh4Lw9VUadjUxct7cpaUF2WdY19W8i6P0hZlB3t95SnGlvSvklKRiTIjHGqI3624kzzb7C2uw79lv7ukbvdg8EPIqp6h-Cjs3xLVSNyIXa5qHb1npnK8HiQ--pQYI75Too-2ec0odJZRJNZN6Su2YC1y-DZqZUP_u5E75lZoq1pzo8Lq-qaZ3TWvPDLm9CkW6fNxsIvOE6PhQ">