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

    <tr>
        <th>Summary</th>
        <td>
            alignas attribute not recognized in specifier-qualifier position of a member declaration
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following C program
```
#include <stdalign.h>
struct alignas_test { char c; char alignas (8) alignas_8; };
```
gives a compilation error when compiled by `clang -std=gnu2x`. The clang version is 17.0.4.

How to reproduce:
```
$ cat foo.c
#include <stdalign.h>
struct alignas_test { char c; char alignas (8) alignas_8; };
$ clang -std=gnu2x -c foo.c
foo.c:2:36: error: 'alignas' attribute cannot be applied to types
    2 | struct alignas_test { char c; char alignas (8) alignas_8; };
      |                                    ^
1 error generated.
```

The `alignas (8)` attribute is accepted when moved after the member name (i.e. right before the semicolon), but that is not where ISO C 23 wants to see it. Quoting ISO C 23 § 6.7.5 paragraph 2:
"An alignment specifier shall appear only
  - in the declaration specifiers of a declaration, or
  - in the specifier-qualifier list of a member declaration, or
  - in the type name of a compound literal.

An alignment specifier shall not be used in conjunction with
- either of the storage-class specifiers typedef or register, nor
- in a declaration of a function or bit-field."

According to the definitions of `member-declaration` and `specifier-qualifier-list` in ISO C 23 § 6.7.2.1, in the code above, `alignas (8)` is part of a `specifier-qualifier`; therefore it is valid.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzElU-PuzYTx1-NuYxAYAgkBw7Z7LN6eqqq9l4ZewD_ZGxqm6TbV18NsLvZbvrnUKkkIsT2fD3z8XcSEYIeLGLLDk_s8JyIJY7Ot90odGcw6Zx6bX8aEXpnjLtpO8AFZu8GLyaWP7P8zOp8f29feamtNItCYOUlRCWMHmw2svJ_24IQ_SIjrMMi_BwxRGDNE8hRe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