Authors: Thiago Adams, Jens Gustedt
Date: 2026-04-02
Submitted against: C23
Status: Open
The current text has the following syntax for compound literals
compound-literal:
(storage-class-specifiersopt type-name)braced-initializer
It seems that the term type-name has no possibility to have leading
attributes, so the current syntax does not allow to specify attributes
that would directly be applicable to the object that is created by a
compound literal. Currently the only useful one from the standard
attributes seem to be [[maybe_unused]], but still that seems an
unnecessary restriction.
Add the following line to the storage-class-specifiers production
storage-class-specifiers:
attribute-specifier-sequence
storage-class-specifier
storage-class-specifiers storage-class-specifier
This would just introduce the possibility to prefix the current construct with attributes. (storage-class-specifiers is only used by compound-literal.)