CWG Issue 2538 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-07


2538. Can standard attributes be syntactically ignored?

Section: 9.13.1 [dcl.attr.grammar]Status: C++23Submitter: Jens MaurerDate: 2021-12-02Liaison: EWG

P2720R0 comment GB 055

[Accepted as a DR at the November, 2022 meeting.]

Subclause 9.13.1 [dcl.attr.grammar] paragraph 6 specifies that an unrecognized attribute-token is ignored:

For an attribute-token (including an_attribute-scoped-token_) not specified in this document, the behavior is implementation-defined. Any attribute-token that is not recognized by the implementation is ignored.

The intent is that only non-standard unrecognized _attribute-token_s can be ignored; in particular, an implementation is required to syntax-check all standard attributes, even if the implementation then chooses not to effect any semantics for that attribute.

The paper introducing attributes wasN2761; the phrasing in question was introduced byP0283R2attempting to implement the design change presented inP0283R1.

See also paperP2552(On the ignorability of standard attributes).

Suggested resolution:

Change in 9.13.1 [dcl.attr.grammar] paragraph 6 as follows:

For an attribute-token (including an_attribute-scoped-token_) not specified in this document, the behavior is implementation-defined. Any ; any such attribute-token that is not recognized by the implementation is ignored.

EWG telecon 2022-05-26

See paper issue 1252.

There was consensus for the statement "It is EWG's intent that [dcl.attr]/6 ONLY permits an implementation to ignore a standard attribute's effect, but not appertainment and argument parsing." To be confirmed by electronic polling.

Proposed resolution (approved by CWG 2022-07-01) [SUPERSEDED]:

Change in 9.13.1 [dcl.attr.grammar] paragraph 6 as follows:

For an attribute-token (including an_attribute-scoped-token_) not specified in this document, the behavior is implementation-defined. Any ; any such attribute-token that is not recognized by the implementation is ignored.[ Note: A program is ill-formed if it contains an _attribute_ specified in 9.13 [dcl.attr] that violates the rules to which entity or statement the attribute may apply or the syntax rules for the attribute's attribute-argument-clause, if any. -- end note ]

EWG 2022-06 electronic polling

No consensus. Seevote.

EWG 2022-11-08

Approved the direction of the 2022-07-01 proposed resolution.

Proposed resolution (approved by CWG 2022-11-08):

Change in 9.13.1 [dcl.attr.grammar] paragraph 6 as follows:

For an attribute-token (including an_attribute-scoped-token_) not specified in this document, the behavior is implementation-defined. Any ; any such attribute-token that is not recognized by the implementation is ignored.[ Note: A program is ill-formed if it contains an _attribute_ specified in 9.13 [dcl.attr] that violates the rules specifying to which entity or statement the attribute may apply or the syntax rules for the attribute's attribute-argument-clause, if any. -- end note ]