Authors: Thiago Adams, Jens Gustedt
Date: 2026-04-02
Submitted against: C23
Status: Review
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.)
Comment from Issues list maintainer on 2026-11-26:
At the November 2026 (Búzios) meeting of WG14, Aaron Ballman said that this was intentionally omitted when attributes were added, and the following proposed response was accepted, subject to review at the April 2027 meeting.
This is a request for a new feature that needs to be submitted in a paper rather than handling through issue resolution.