Authors: Joseph Myers
Date: 2025-03-11
Submitted against: C23
Status: Open
C23 6.7.3.2 (Structure and union specifiers) contains a constraint:
An attribute specifier sequence shall not appear in a struct-or-union specifier without a member declaration list, except in a declaration of the form:
struct-or-union attribute-specifier-sequence identifier
;
C23 6.7.3.4 (Tags) contains a stricter constraint:
A type specifier of the form
struct-or-union attribute-specifier-sequenceopt identifier
shall not contain an attribute specifier sequence.
The latter constraint does not make sense; if such an attribute specifier sequence is not allowed, why is this case in the syntax for struct-or-union-specifier at all?
The stated intent given in drafting notes in N2335 was:
struct [[something]] x; /* valid */
void f(struct [[something]] s); /* invalid */
However, both those cases go through the syntax for type-specifier, so both would be invalid with the constraints as written.
I think the latter constraint is in fact not needed at all because everything relevant is covered in the first quoted constraint.
In C23 6.7.3.4 (Tags), remove the paragraph (including attached footnote):
A type specifier of the form
struct-or-union attribute-specifier-sequenceopt identifier
shall not contain an attribute specifier sequence.141)
141) As specified in 6.7.3.2, the type specifier can be followed by a;
or a member declaration list.