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

    <tr>
        <th>Summary</th>
        <td>
            Clang (wrongly?) accepts GNU-style function attributes followed by C23-style attributes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c,
            c2x,
            clang:frontend,
            accepts-invalid
      </td>
    </tr>

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

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

<pre>
    `clang -std=c2x` currently allows using a GNU-style `__attribute__` followed by a C23-style attribute specifier.

I was under the impression it wasn't allowed when I filed a [bug](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796) on the GCC side, but then was told it possibly should be, but Joseph Myers weighed in and explained that it likely shouldn't be: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796#c6:
>The logic is that GNU attributes are declaration specifiers (and can mix 
>anywhere with other declaration specifiers), but standard attributes 
>aren't declaration specifiers; rather, they come in specified positions 
>relative to declaration specifiers (the semantics before and after the 
>declaration specifiers are different), and in the middle isn't such a 
>position.

I'm going to call this _accepts-invalid_ based on that comment for now.

Reproducer:
```
$ cat /tmp/foo.c
__attribute__((noreturn)) [[noreturn]]
void foo(void) {
        while(true);
}

$ clang -std=c2x /tmp/foo.c -S # succeeds, clang 16.0.0_rc2

$ gcc -std=c2x /tmp/foo.c -S # fails, 13.0.1 20230212
/tmp/foo.c:2:1: warning: ‘noreturn’ attribute ignored [-Wattributes]
    2 | void foo(void) {
      | ^~~~
/tmp/foo.c:2:1: error: expected identifier or ‘(’ before ‘void’
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYT_jXjy8CCTEWydPDBsdeLfYF3D20XPRoUOZLYUqRBUnHcw_72gpL8EaPbvTRwEpozfPjMMx_k3qvWEG0gf4V8v-BD6KzbhI487-PvorbysoEiFZqbFpc-SMj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